diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/templates/literals-escape.html | 2 | ||||
-rw-r--r-- | testing/tests/simple.rs | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/testing/templates/literals-escape.html b/testing/templates/literals-escape.html new file mode 100644 index 0000000..4886cfb --- /dev/null +++ b/testing/templates/literals-escape.html @@ -0,0 +1,2 @@ +{{ '\x41' }}{{ '\n' }}{{ '\r' }}{{ '\t' }}{{ '\\' }}{{ '\0' }}{{ '\u{2665}' }}{{ '\'' }}{{ '\"' }}{{ '"' }} +{{ "\x41\n\r\t\\\0\u{2665}\'\"'" }} diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index 53f1122..a075d26 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -122,6 +122,19 @@ fn test_literals() { assert_eq!(s.render().unwrap(), "a\na\ntrue\nfalse"); } +#[derive(Template)] +#[template(path = "literals-escape.html")] +struct LiteralsEscapeTemplate {} + +#[test] +fn test_literals_escape() { + let s = LiteralsEscapeTemplate {}; + assert_eq!( + s.render().unwrap(), + "A\n\r\t\\\0♥'""\nA\n\r\t\\\0♥'"'" + ); +} + struct Holder { a: usize, } |