askama/testing/tests/no_implicit_prelude.rs
2025-08-19 17:41:20 +02:00

28 lines
603 B
Rust

#![no_implicit_prelude]
use ::askama::Template;
#[test]
fn test_source() {
#[derive(Template)]
#[template(ext = "html", source = "Hello, {{ name }}!")]
struct HelloTemplate<'a> {
name: &'a str,
}
let hello = HelloTemplate { name: "world" };
::std::assert_eq!("Hello, world!", hello.render().unwrap());
}
#[test]
fn test_path() {
#[derive(Template)]
#[template(path = "hello.html")]
struct HelloTemplate<'a> {
name: &'a str,
}
let hello = HelloTemplate { name: "world" };
::std::assert_eq!("Hello, world!", hello.render().unwrap());
}