From cef055108de6c51c1423cd6a8919730ef01f64a3 Mon Sep 17 00:00:00 2001 From: Tuomas Siipola Date: Fri, 3 Jan 2020 20:36:17 +0200 Subject: Support char literals --- testing/tests/matches.rs | 15 +++++++++++++++ testing/tests/simple.rs | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'testing/tests') diff --git a/testing/tests/matches.rs b/testing/tests/matches.rs index 3e6d636..811f3ce 100644 --- a/testing/tests/matches.rs +++ b/testing/tests/matches.rs @@ -47,6 +47,21 @@ fn test_match_literal() { assert_eq!(s.render().unwrap(), "\n\nElse found qux\n"); } +#[derive(Template)] +#[template(path = "match-literal-char.html")] +struct MatchLitCharTemplate { + item: char, +} + +#[test] +fn test_match_literal_char() { + let s = MatchLitCharTemplate { item: 'b' }; + assert_eq!(s.render().unwrap(), "\n\nFound literal b\n"); + + let s = MatchLitCharTemplate { item: 'c' }; + assert_eq!(s.render().unwrap(), "\n\nElse found c\n"); +} + #[derive(Template)] #[template(path = "match-literal-num.html")] struct MatchLitNumTemplate { diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index 6dbfcfb..53f1122 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -119,7 +119,7 @@ struct LiteralsTemplate {} #[test] fn test_literals() { let s = LiteralsTemplate {}; - assert_eq!(s.render().unwrap(), "a\ntrue\nfalse"); + assert_eq!(s.render().unwrap(), "a\na\ntrue\nfalse"); } struct Holder { -- cgit