aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2024-01-18 10:47:37 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2024-01-18 11:23:18 +0100
commit79738ff2388a6f15cd28690a3d276ee5086fb44f (patch)
treecfcc54938cfaf09bfbfc1b0e0b25d43463385caf /testing/tests
parent29b25505b496510217a39606a5f72884867ef492 (diff)
downloadaskama-79738ff2388a6f15cd28690a3d276ee5086fb44f.tar.gz
askama-79738ff2388a6f15cd28690a3d276ee5086fb44f.tar.bz2
askama-79738ff2388a6f15cd28690a3d276ee5086fb44f.zip
Fix support for mixed case variables
Diffstat (limited to 'testing/tests')
-rw-r--r--testing/tests/simple.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
index f0f0a26..ba806e2 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -484,3 +484,23 @@ fn test_num_literals() {
"[90, -90, 90, 2, 56, 240, 10.5, 10.5, 100000000000, 105000000000]",
);
}
+
+#[allow(non_snake_case)]
+#[derive(askama::Template)]
+#[template(source = "{{ xY }}", ext = "txt")]
+struct MixedCase {
+ xY: &'static str,
+}
+
+/// Test that we can use mixed case in variable names
+///
+/// We use some heuristics to distinguish paths (`std::str::String`) from
+/// variable names (`foo`). Previously, this test would fail because any
+/// name containing uppercase characters would be considered a path.
+///
+/// https://github.com/djc/askama/issues/924
+#[test]
+fn test_mixed_case() {
+ let template = MixedCase { xY: "foo" };
+ assert_eq!(template.render().unwrap(), "foo");
+}