33from testutils import run_tests
44from pytest import raises
55
6-
76dedent = lambda s : s .replace ("\n " , "\n " ).strip ()
87
98
@@ -36,9 +35,6 @@ def test_parse_shader_error1(caplog):
3635 │
3736 9 │ out.invalid_attr = vec4<f32>(0.0, 0.0, 1.0);
3837 │ ^^^^^^^^^^^^ invalid accessor
39-
40-
41- invalid field accessor `invalid_attr`
4238 """
4339
4440 code = dedent (code )
@@ -47,6 +43,7 @@ def test_parse_shader_error1(caplog):
4743 device .create_shader_module (code = code )
4844
4945 error = err .value .message
46+ error = error .rstrip ("\n " )
5047 assert error == expected , f"Expected:\n \n { expected } "
5148
5249
@@ -72,9 +69,6 @@ def test_parse_shader_error2(caplog):
7269 │
7370 2 │ @location(0) texcoord : vec2<f32>;
7471 │ ^ expected `,`
75-
76-
77- expected `,`, found ";"
7872 """
7973
8074 code = dedent (code )
@@ -83,6 +77,7 @@ def test_parse_shader_error2(caplog):
8377 device .create_shader_module (code = code )
8478
8579 error = err .value .message
80+ error = error .rstrip ("\n " )
8681 assert error == expected , f"Expected:\n \n { expected } "
8782
8883
@@ -108,9 +103,6 @@ def test_parse_shader_error3(caplog):
108103 │
109104 3 │ @builtin(position) position: vec4<f3>,
110105 │ ^^ unknown type
111-
112-
113- unknown type: `f3`
114106 """
115107
116108 code = dedent (code )
@@ -119,6 +111,7 @@ def test_parse_shader_error3(caplog):
119111 device .create_shader_module (code = code )
120112
121113 error = err .value .message
114+ error = error .rstrip ("\n " )
122115 assert error == expected , f"Expected:\n \n { expected } "
123116
124117
@@ -140,9 +133,6 @@ def test_parse_shader_error4(caplog):
140133 In wgpuDeviceCreateShaderModule
141134
142135 Shader '' parsing error: Index 4 is out of bounds for expression [10]
143-
144-
145- Index 4 is out of bounds for expression [10]
146136 """
147137
148138 code = dedent (code )
@@ -151,6 +141,7 @@ def test_parse_shader_error4(caplog):
151141 device .create_shader_module (code = code )
152142
153143 error = err .value .message
144+ error = error .rstrip ("\n " ) # seems to have tailing newlines sometimes?
154145 assert error == expected , f"Expected:\n \n { expected } "
155146
156147
@@ -191,9 +182,8 @@ def test_validate_shader_error1(caplog):
191182 = Operation Multiply can't work with [4] (of type Matrix { columns: Quad, rows: Quad, scalar: Scalar { kind: Float, width: 4 } }) and [6] (of type Vector { size: Tri, scalar: Scalar { kind: Float, width: 4 } })
192183
193184
194- Entry point vs_main at Vertex is invalid
195- Expression [7] is invalid
196- Operation Multiply can't work with [4] (of type Matrix { columns: Quad, rows: Quad, scalar: Scalar { kind: Float, width: 4 } }) and [6] (of type Vector { size: Tri, scalar: Scalar { kind: Float, width: 4 } })
185+ Expression [7] is invalid
186+ Operation Multiply can't work with [4] (of type Matrix { columns: Quad, rows: Quad, scalar: Scalar { kind: Float, width: 4 } }) and [6] (of type Vector { size: Tri, scalar: Scalar { kind: Float, width: 4 } })
197187 """
198188
199189 code = dedent (code )
@@ -243,8 +233,7 @@ def test_validate_shader_error2(caplog):
243233 = The `return` expression Some([8]) does not match the declared return type Some([0])
244234
245235
246- Entry point fs_main at Vertex is invalid
247- The `return` expression Some([8]) does not match the declared return type Some([0])
236+ The `return` expression Some([8]) does not match the declared return type Some([0])
248237 """
249238
250239 code = dedent (code )
0 commit comments