2021-02-13 20:54:31 +00:00
|
|
|
#[cfg(feature = "wgsl-in")]
|
|
|
|
macro_rules! err {
|
|
|
|
($value:expr, @$snapshot:literal) => {
|
2021-02-28 04:22:34 +00:00
|
|
|
::insta::assert_snapshot!(
|
|
|
|
naga::front::wgsl::parse_str($value)
|
|
|
|
.expect_err("expected parser error")
|
|
|
|
.emit_to_string(),
|
|
|
|
@$snapshot
|
|
|
|
);
|
2021-02-13 20:54:31 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "wgsl-in")]
|
|
|
|
#[test]
|
|
|
|
fn function_without_identifier() {
|
|
|
|
err!(
|
|
|
|
"fn () {}",
|
2021-02-28 04:22:34 +00:00
|
|
|
@r###"
|
|
|
|
error: expected identifier, found '('
|
|
|
|
┌─ wgsl:1:4
|
|
|
|
│
|
|
|
|
1 │ fn () {}
|
|
|
|
│ ^ expected identifier
|
|
|
|
|
|
|
|
"###
|
2021-02-13 20:54:31 +00:00
|
|
|
);
|
|
|
|
}
|