diff options
author | Kelly Thomas Kline <kellytk@sw-e.org> | 2021-10-13 02:58:58 -0700 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-10-13 13:59:12 +0200 |
commit | c288f7fafa9745f6f78eabd818fdc37af8ba2674 (patch) | |
tree | 041d2085f69116c83624aa08902ead41c9e1c977 /testing/tests | |
parent | 4582b624b28c1ccaebccac7bd44915dadbe7443d (diff) | |
download | askama-c288f7fafa9745f6f78eabd818fdc37af8ba2674.tar.gz askama-c288f7fafa9745f6f78eabd818fdc37af8ba2674.tar.bz2 askama-c288f7fafa9745f6f78eabd818fdc37af8ba2674.zip |
Initial test work
Diffstat (limited to 'testing/tests')
-rw-r--r-- | testing/tests/methods.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/testing/tests/methods.rs b/testing/tests/methods.rs index d24000e..cdd0e36 100644 --- a/testing/tests/methods.rs +++ b/testing/tests/methods.rs @@ -19,6 +19,22 @@ fn test_self_method() { } #[derive(Template)] +#[template(source = "{{ self.type() }}", ext = "txt")] +struct SelfRawIdentifierMethodTemplate {} + +impl SelfRawIdentifierMethodTemplate { + fn r#type(&self) -> &str { + "foo" + } +} + +#[test] +fn test_self_rawidentifiermethod() { + let t = SelfRawIdentifierMethodTemplate {}; + assert_eq!(t.render().unwrap(), "foo"); +} + +#[derive(Template)] #[template(source = "{{ self.get_s() }} {{ t.get_s() }}", ext = "txt")] struct NestedSelfMethodTemplate<'a> { t: SelfMethodTemplate<'a>, |