[wgsl] Add parser error snapshot

This commit is contained in:
Joshua Groves 2021-02-13 17:24:31 -03:30 committed by Dzmitry Malyshau
parent fa7d4d8b51
commit ce84b1d1c0

15
tests/errors.rs Normal file
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"
);
}