If we need it, there's a way to more granularly test expressions and statements.
Testing expressions
import { CAPTURE, extractSnippetsFromFn } from 'typegpu-testing-utility';
// ...
function foo() {
'use gpu';
return 5 + (CAPTURE(6 + 7));
// ^^^^^
}
expect(extractSnippetsFromFn(foo)[0]!.dataType.type).toMatchInlineSnapshot('abstractInt');
Testing statements
import { CAPTURE_FOLLOWING, extractSnippetsFromFn } from 'typegpu-testing-utility';
// ...
function foo() {
'use gpu';
CAPTURE_FOLLOWING();
return 5 + 6 + 7;
// ^^^^^^^^^^^^^^
}
expect(extractSnippetsFromFn(foo)[0]!.dataType.type).toMatchInlineSnapshot('void');
If we need it, there's a way to more granularly test expressions and statements.
Testing expressions
Testing statements