[wgsl] Add parser error snapshot

This commit is contained in:
Joshua Groves authored and Dzmitry Malyshau committed 2021-02-22 01:17:15 -05:00
1 parent fa7d4d8b51
commit ce84b1d1c0
1 file changed
+15
+15
View File
@@ -0,0 +1,15 @@
#[cfg(feature = "wgsl-in")]
macro_rules! err {
($value:expr, @$snapshot:literal) => {
::insta::assert_snapshot!(naga::front::wgsl::parse_str($value).expect_err("expected parser error").to_string(), @$snapshot);
};
}
#[cfg(feature = "wgsl-in")]
#[test]
fn function_without_identifier() {
err!(
"fn () {}",
@"error while parsing WGSL in scopes [FunctionDecl] at line 1 pos 4: unexpected token Paren('('), expected ident"
);
}