aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests
diff options
context:
space:
mode:
authorLibravatar Anthony Nowell <anowell@gmail.com>2017-11-01 21:19:34 -0700
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-11-02 15:11:20 +0100
commit2257afd356e6985244e702554aeda74af63b7ff1 (patch)
treee4850337eb72afb32cbd259f3b79f114cef05a9b /testing/tests
parent89a90eb46c822957af5b6aef8615a7d7398e7de4 (diff)
downloadaskama-2257afd356e6985244e702554aeda74af63b7ff1.tar.gz
askama-2257afd356e6985244e702554aeda74af63b7ff1.tar.bz2
askama-2257afd356e6985244e702554aeda74af63b7ff1.zip
Support matching custom enums
Diffstat (limited to '')
-rw-r--r--testing/tests/matches.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/tests/matches.rs b/testing/tests/matches.rs
index b8a6c98..86d32be 100644
--- a/testing/tests/matches.rs
+++ b/testing/tests/matches.rs
@@ -63,3 +63,22 @@ fn test_match_literal_num() {
let s = MatchLitNumTemplate { item: 23 };
assert_eq!(s.render().unwrap(), "\n\nElse found 23\n");
}
+
+#[allow(dead_code)]
+enum Color {
+ Rgb(u32, u32, u32),
+ GrayScale(u32),
+ Cmyk(u32, u32, u32, u32)
+}
+
+#[derive(Template)]
+#[template(path = "match-custom-enum.html")]
+struct MatchCustomEnumTemplate {
+ color: Color,
+}
+
+#[test]
+fn test_match_custom_enum() {
+ let s = MatchCustomEnumTemplate { color: Color::Rgb(160, 0, 255) };
+ assert_eq!(s.render().unwrap(), "\n\nColorful: #A000FF\n");
+}