| <!DOCTYPE html> |
| <html> |
| <meta charset=utf-8> |
| <meta name="timeout" content="long"> |
| <title>Test prefix/postfix.</title> |
| <script src="js/test-harness.js"></script> |
| <script src="../js/webgpu-functions.js"></script> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script> |
| const whlslTests = {}; |
| |
| whlslTests.variableShadowing = async () => |
| { |
| let program = ` |
| int foo() |
| { |
| int y; |
| int x = 7; |
| { |
| int x = 8; |
| y = x; |
| } |
| return y; |
| } |
| `; |
| assert_equals(await callIntFunction(program, "foo", []), 8); |
| |
| program = ` |
| int foo() |
| { |
| int y; |
| int x = 7; |
| { |
| int x = 8; |
| } |
| y = x; |
| return y; |
| } |
| `; |
| assert_equals(await callIntFunction(program, "foo", []), 7); |
| } |
| |
| runTests(whlslTests); |
| </script> |
| </html> |