diff --git a/crates/stef-build/tests/compiler.rs b/crates/stef-build/tests/compiler.rs
index 1266250..81b563d 100644
--- a/crates/stef-build/tests/compiler.rs
+++ b/crates/stef-build/tests/compiler.rs
@@ -1,6 +1,6 @@
use std::fs;
-use insta::{assert_snapshot, glob};
+use insta::{assert_snapshot, glob, with_settings};
use stef_parser::Schema;
#[test]
@@ -11,7 +11,12 @@ fn compile_schema() {
let value = stef_build::compile_schema(&value);
let value = prettyplease::unparse(&syn::parse2(value.clone()).unwrap());
- assert_snapshot!("compile", format!("{value}"), input.trim());
+ with_settings!({
+ description => input.trim(),
+ omit_expression => true,
+ }, {
+ assert_snapshot!("compile", value);
+ });
});
}
@@ -23,6 +28,11 @@ fn compile_schema_extra() {
let value = stef_build::compile_schema(&value);
let value = prettyplease::unparse(&syn::parse2(value.clone()).unwrap());
- assert_snapshot!("compile_extra", format!("{value}"), input.trim());
+ with_settings!({
+ description => input.trim(),
+ omit_expression => true,
+ }, {
+ assert_snapshot!("compile_extra", value);
+ });
});
}
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@alias_basic.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@alias_basic.stef.snap
index aaa498e..0e93452 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@alias_basic.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@alias_basic.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "/// Sample type alias.\ntype Sample = u32;"
+description: "/// Sample type alias.\ntype Sample = u32;"
input_file: crates/stef-parser/tests/inputs/alias_basic.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@attribute_multi.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@attribute_multi.stef.snap
index 97ad6a9..38c8296 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@attribute_multi.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@attribute_multi.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "#[validate(min = 1, max = 100)]\nstruct Sample"
+description: "#[validate(min = 1, max = 100)]\nstruct Sample"
input_file: crates/stef-parser/tests/inputs/attribute_multi.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@attribute_single.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@attribute_single.stef.snap
index f4051a0..c1b11d2 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@attribute_single.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@attribute_single.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "#[deprecated = \"don't use\"]\nstruct Sample"
+description: "#[deprecated = \"don't use\"]\nstruct Sample"
input_file: crates/stef-parser/tests/inputs/attribute_single.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@attribute_unit.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@attribute_unit.stef.snap
index 38058da..b8ea5b4 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@attribute_unit.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@attribute_unit.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "#[deprecated]\nstruct Sample"
+description: "#[deprecated]\nstruct Sample"
input_file: crates/stef-parser/tests/inputs/attribute_unit.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@attributes.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@attributes.stef.snap
index 9f150dc..2aa74d6 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@attributes.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@attributes.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "#[deprecated = \"don't use\", compress]\n#[validate(\n in_range(min = 100, max = 200),\n non_empty,\n)]\nstruct Sample"
+description: "#[deprecated = \"don't use\", compress]\n#[validate(\n in_range(min = 100, max = 200),\n non_empty,\n)]\nstruct Sample"
input_file: crates/stef-parser/tests/inputs/attributes.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@attributes_min_ws.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@attributes_min_ws.stef.snap
index d40aeac..caca7fd 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@attributes_min_ws.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@attributes_min_ws.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "#[deprecated=\"don't use\",compress]\n#[validate(in_range(min=100,max=200),non_empty)]\nstruct Sample"
+description: "#[deprecated=\"don't use\",compress]\n#[validate(in_range(min=100,max=200),non_empty)]\nstruct Sample"
input_file: crates/stef-parser/tests/inputs/attributes_min_ws.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@const_basic.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@const_basic.stef.snap
index cd5a6ed..1a1b83f 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@const_basic.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@const_basic.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "const BOOL_TRUE: bool = true;\nconst BOOL_FALSE: bool = false;\nconst INT: u32 = 100;\nconst FLOAT: f64 = 5.5;\nconst STRING: string = \"value\";\nconst BYTES: bytes = [1, 2, 3];"
+description: "const BOOL_TRUE: bool = true;\nconst BOOL_FALSE: bool = false;\nconst INT: u32 = 100;\nconst FLOAT: f64 = 5.5;\nconst STRING: string = \"value\";\nconst BYTES: bytes = [1, 2, 3];"
input_file: crates/stef-parser/tests/inputs/const_basic.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@const_string.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@const_string.stef.snap
index af14546..86704af 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@const_string.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@const_string.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "const SIMPLE: string = \"value\";\n\nconst NEWLINE_ESCAPE: string = \"one \\\n two \\\n three\\\n\";\n\nconst ESCAPES: string = \"escape basics \\r\\n \\t \\b \\f \\\\ \\\"\\\n hello\\\" \\n\\\n unicode \\u{2764} \\\n emoji ❤ \\\n\";\n\nconst MULTILINE: string = \"a\n b\n c\n\";"
+description: "const SIMPLE: string = \"value\";\n\nconst NEWLINE_ESCAPE: string = \"one \\\n two \\\n three\\\n\";\n\nconst ESCAPES: string = \"escape basics \\r\\n \\t \\b \\f \\\\ \\\"\\\n hello\\\" \\n\\\n unicode \\u{2764} \\\n emoji ❤ \\\n\";\n\nconst MULTILINE: string = \"a\n b\n c\n\";"
input_file: crates/stef-parser/tests/inputs/const_string.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@enum_basic.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@enum_basic.stef.snap
index cfc8bdc..d6d790d 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@enum_basic.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@enum_basic.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "/// Sample enum.\nenum Sample {\n One @1,\n /// Second variant\n Two(u32 @1, u64 @2) @2,\n Three {\n field1: u32 @1,\n /// Second field of third variant\n field2: bool @2,\n } @3,\n}"
+description: "/// Sample enum.\nenum Sample {\n One @1,\n /// Second variant\n Two(u32 @1, u64 @2) @2,\n Three {\n field1: u32 @1,\n /// Second field of third variant\n field2: bool @2,\n } @3,\n}"
input_file: crates/stef-parser/tests/inputs/enum_basic.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@enum_generics.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@enum_generics.stef.snap
index 7e8ff94..b73ff14 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@enum_generics.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@enum_generics.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "/// Enum with generics.\nenum Sample {\n One @1,\n Two(A @1, B @2) @2,\n Three {\n field1: C @1,\n field2: D @2,\n } @3,\n}"
+description: "/// Enum with generics.\nenum Sample {\n One @1,\n Two(A @1, B @2) @2,\n Three {\n field1: C @1,\n field2: D @2,\n } @3,\n}"
input_file: crates/stef-parser/tests/inputs/enum_generics.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@enum_many_ws.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@enum_many_ws.stef.snap
index a6ecc5f..6d915b1 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@enum_many_ws.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@enum_many_ws.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "/// Sample enum.\n enum Sample {\n\n One @1,\n\n Two ( u32 @1, u64 @2) @2,\n\n Three {\n\n field1: u32 @1,\n\n field2: bool @2,\n\n } @3,\n\n }"
+description: "/// Sample enum.\n enum Sample {\n\n One @1,\n\n Two ( u32 @1, u64 @2) @2,\n\n Three {\n\n field1: u32 @1,\n\n field2: bool @2,\n\n } @3,\n\n }"
input_file: crates/stef-parser/tests/inputs/enum_many_ws.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@enum_min_ws.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@enum_min_ws.stef.snap
index f904f6d..c3e3a7b 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@enum_min_ws.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@enum_min_ws.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "enum Sample{One@1,Two(u32@1,u64@2,T@3)@2,Three{field1:u32@1,field2:bool@2,field3:T@3}@3}"
+description: "enum Sample{One@1,Two(u32@1,u64@2,T@3)@2,Three{field1:u32@1,field2:bool@2,field3:T@3}@3}"
input_file: crates/stef-parser/tests/inputs/enum_min_ws.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@import_basic.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@import_basic.stef.snap
index bc6b26e..6c4c5bf 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@import_basic.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@import_basic.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "use other::schema::Sample;\nuse second::submodule;"
+description: "use other::schema::Sample;\nuse second::submodule;"
input_file: crates/stef-parser/tests/inputs/import_basic.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@module_basic.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@module_basic.stef.snap
index d989fe2..954dc83 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@module_basic.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@module_basic.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "mod a {\n /// Inner module\n mod b {\n enum Sample {\n One @1,\n }\n }\n\n struct Sample {\n value: u32 @1,\n }\n}"
+description: "mod a {\n /// Inner module\n mod b {\n enum Sample {\n One @1,\n }\n }\n\n struct Sample {\n value: u32 @1,\n }\n}"
input_file: crates/stef-parser/tests/inputs/module_basic.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@schema_basic.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@schema_basic.stef.snap
index 9c0f86c..637313c 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@schema_basic.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@schema_basic.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "/// Basic struct.\nstruct SampleStruct {\n a: u32 @1,\n b: bool @2,\n}\n\n/// Sample enum.\nenum SampleEnum {\n One @1,\n Two(u32 @1, u64 @2) @2,\n Three {\n field1: u32 @1,\n field2: bool @2,\n } @3,\n}"
+description: "/// Basic struct.\nstruct SampleStruct {\n a: u32 @1,\n b: bool @2,\n}\n\n/// Sample enum.\nenum SampleEnum {\n One @1,\n Two(u32 @1, u64 @2) @2,\n Three {\n field1: u32 @1,\n field2: bool @2,\n } @3,\n}"
input_file: crates/stef-parser/tests/inputs/schema_basic.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@struct_basic.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@struct_basic.stef.snap
index 6c8d745..dfcfbac 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@struct_basic.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@struct_basic.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "/// Basic struct.\nstruct Sample {\n a: u32 @1,\n /// Second field\n b: bool @2,\n}"
+description: "/// Basic struct.\nstruct Sample {\n a: u32 @1,\n /// Second field\n b: bool @2,\n}"
input_file: crates/stef-parser/tests/inputs/struct_basic.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@struct_generics.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@struct_generics.stef.snap
index b50e06d..2a2e25e 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@struct_generics.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@struct_generics.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "/// Generic key-value pair.\nstruct KeyValue {\n key: K @1,\n value: V @2,\n}"
+description: "/// Generic key-value pair.\nstruct KeyValue {\n key: K @1,\n value: V @2,\n}"
input_file: crates/stef-parser/tests/inputs/struct_generics.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@struct_many_ws.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@struct_many_ws.stef.snap
index 01c05fa..5c74b76 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@struct_many_ws.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@struct_many_ws.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "/// Some comment\n struct Sample<\n T\n > {\n\n a: u32 @1,\n b: bool @2,\n c: T @3,\n }"
+description: "/// Some comment\n struct Sample<\n T\n > {\n\n a: u32 @1,\n b: bool @2,\n c: T @3,\n }"
input_file: crates/stef-parser/tests/inputs/struct_many_ws.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@struct_min_ws.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@struct_min_ws.stef.snap
index aa9412e..4c02110 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@struct_min_ws.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@struct_min_ws.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "struct Sample{a:u32@1,b:bool@2,c:T@3}"
+description: "struct Sample{a:u32@1,b:bool@2,c:T@3}"
input_file: crates/stef-parser/tests/inputs/struct_min_ws.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@struct_tuple.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@struct_tuple.stef.snap
index 5a2b73c..ff8e473 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@struct_tuple.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@struct_tuple.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "/// Basic struct.\nstruct Sample(u32 @1, bool @2)"
+description: "/// Basic struct.\nstruct Sample(u32 @1, bool @2)"
input_file: crates/stef-parser/tests/inputs/struct_tuple.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@types_basic.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@types_basic.stef.snap
index 63e8e77..55571ec 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@types_basic.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@types_basic.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "struct Sample {\n f01: bool @1,\n f02: u8 @2,\n f03: u16 @3,\n f04: u32 @4,\n f05: u64 @5,\n f06: u128 @6,\n f07: i8 @7,\n f08: i16 @8,\n f09: i32 @9,\n f10: i64 @10,\n f11: i128 @11,\n f12: f32 @12,\n f13: f64 @13,\n f14: string @14,\n f15: &string @15,\n f16: bytes @16,\n f17: &bytes @17,\n f18: box @18,\n f19: box @19,\n f20: (u32, u32, u32) @20,\n f21: [u32; 12] @21,\n}"
+description: "struct Sample {\n f01: bool @1,\n f02: u8 @2,\n f03: u16 @3,\n f04: u32 @4,\n f05: u64 @5,\n f06: u128 @6,\n f07: i8 @7,\n f08: i16 @8,\n f09: i32 @9,\n f10: i64 @10,\n f11: i128 @11,\n f12: f32 @12,\n f13: f64 @13,\n f14: string @14,\n f15: &string @15,\n f16: bytes @16,\n f17: &bytes @17,\n f18: box @18,\n f19: box @19,\n f20: (u32, u32, u32) @20,\n f21: [u32; 12] @21,\n}"
input_file: crates/stef-parser/tests/inputs/types_basic.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@types_generic.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@types_generic.stef.snap
index de09c3a..4837487 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@types_generic.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@types_generic.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "struct Sample {\n f1: vec @1,\n f2: hash_map @2,\n f3: hash_set @3,\n f4: option @4,\n f5: non_zero @5,\n}"
+description: "struct Sample {\n f1: vec @1,\n f2: hash_map @2,\n f3: hash_set @3,\n f4: option @4,\n f5: non_zero @5,\n}"
input_file: crates/stef-parser/tests/inputs/types_generic.stef
---
#[allow(unused_imports)]
diff --git a/crates/stef-build/tests/snapshots/compiler__compile@types_nested.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@types_nested.stef.snap
index 1fb2161..b880705 100644
--- a/crates/stef-build/tests/snapshots/compiler__compile@types_nested.stef.snap
+++ b/crates/stef-build/tests/snapshots/compiler__compile@types_nested.stef.snap
@@ -1,6 +1,6 @@
---
source: crates/stef-build/tests/compiler.rs
-expression: "struct Sample {\n value: vec