Add another integrated render snapshot test

This commit is contained in:
Olivier 'reivilibre' 2024-05-01 22:59:43 +01:00
parent 91ba94a38a
commit b119bf376c
2 changed files with 18 additions and 2 deletions

View File

@ -1,5 +1,5 @@
use bevy_reflect::Reflect; use bevy_reflect::Reflect;
use hornbeam_interpreter::{localisation::NoLocalisation, LoadedTemplates, Params}; use hornbeam_interpreter::{localisation::DebugLocalisationSystem, LoadedTemplates, Params};
use insta::assert_snapshot; use insta::assert_snapshot;
#[derive(Reflect)] #[derive(Reflect)]
@ -20,7 +20,7 @@ fn simple_test_struct() -> SimpleTestStruct {
} }
fn simple_render(template: &str) -> String { fn simple_render(template: &str) -> String {
let mut templates = LoadedTemplates::new(NoLocalisation); let mut templates = LoadedTemplates::new(DebugLocalisationSystem);
templates templates
.load_template_from_str("main", template, "main.hnb") .load_template_from_str("main", template, "main.hnb")
.expect("failed to load template"); .expect("failed to load template");
@ -54,3 +54,14 @@ html
"# "#
)) ))
} }
#[test]
fn snapshot_002() {
assert_snapshot!(simple_render(
r#"
@localiseMe{x=5}
br
"$five"
"#
))
}

View File

@ -0,0 +1,5 @@
---
source: hornbeam_interpreter/tests/snapshots.rs
expression: "simple_render(r#\"\n@localiseMe{x=5}\nbr\n\"$five\"\n \"#)"
---
@localiseMe{{&quot;x&quot;: Int(5)}}<br>5