From b119bf376cfac7365e44871ac8a605e9d6847577 Mon Sep 17 00:00:00 2001 From: Olivier Date: Wed, 1 May 2024 22:59:43 +0100 Subject: [PATCH] Add another integrated render snapshot test --- hornbeam_interpreter/tests/snapshots.rs | 15 +++++++++++++-- .../tests/snapshots/snapshots__snapshot_002.snap | 5 +++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 hornbeam_interpreter/tests/snapshots/snapshots__snapshot_002.snap diff --git a/hornbeam_interpreter/tests/snapshots.rs b/hornbeam_interpreter/tests/snapshots.rs index ba73a62..c05a7b1 100644 --- a/hornbeam_interpreter/tests/snapshots.rs +++ b/hornbeam_interpreter/tests/snapshots.rs @@ -1,5 +1,5 @@ use bevy_reflect::Reflect; -use hornbeam_interpreter::{localisation::NoLocalisation, LoadedTemplates, Params}; +use hornbeam_interpreter::{localisation::DebugLocalisationSystem, LoadedTemplates, Params}; use insta::assert_snapshot; #[derive(Reflect)] @@ -20,7 +20,7 @@ fn simple_test_struct() -> SimpleTestStruct { } fn simple_render(template: &str) -> String { - let mut templates = LoadedTemplates::new(NoLocalisation); + let mut templates = LoadedTemplates::new(DebugLocalisationSystem); templates .load_template_from_str("main", template, "main.hnb") .expect("failed to load template"); @@ -54,3 +54,14 @@ html "# )) } + +#[test] +fn snapshot_002() { + assert_snapshot!(simple_render( + r#" +@localiseMe{x=5} +br +"$five" + "# + )) +} diff --git a/hornbeam_interpreter/tests/snapshots/snapshots__snapshot_002.snap b/hornbeam_interpreter/tests/snapshots/snapshots__snapshot_002.snap new file mode 100644 index 0000000..9d4884e --- /dev/null +++ b/hornbeam_interpreter/tests/snapshots/snapshots__snapshot_002.snap @@ -0,0 +1,5 @@ +--- +source: hornbeam_interpreter/tests/snapshots.rs +expression: "simple_render(r#\"\n@localiseMe{x=5}\nbr\n\"$five\"\n \"#)" +--- +@localiseMe{{"x": Int(5)}}
5