aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/simple.rs
diff options
context:
space:
mode:
Diffstat (limited to 'testing/tests/simple.rs')
-rw-r--r--testing/tests/simple.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
index e7fca2c..b6dd31a 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -232,6 +232,22 @@ fn test_option() {
}
#[derive(Template)]
+#[template(source = "{{ Self::foo(None) }} {{ Self::foo(Some(1)) }}", ext = "txt")]
+struct OptionNoneSomeTemplate;
+
+impl OptionNoneSomeTemplate {
+ fn foo(x: Option<i32>) -> i32 {
+ x.unwrap_or_default()
+ }
+}
+
+#[test]
+fn test_option_none_some() {
+ let t = OptionNoneSomeTemplate;
+ assert_eq!(t.render().unwrap(), "0 1");
+}
+
+#[derive(Template)]
#[template(path = "generics.html")]
struct GenericsTemplate<T, U = u8>
where