@@ -8,7 +8,6 @@ import { namespace } from '../src/core/resolve/namespace.ts';
88import { resolve } from '../src/resolutionCtx.ts' ;
99import type { Infer } from '../src/shared/repr.ts' ;
1010import { arrayLength } from '../src/std/array.ts' ;
11- import { asWgsl } from './utils/parseResolved.ts' ;
1211
1312describe ( 'array' , ( ) => {
1413 it ( 'produces a visually pleasant type' , ( ) => {
@@ -179,7 +178,7 @@ describe('array', () => {
179178 const defaultValue = Outer ( ) ;
180179 } ) ;
181180
182- expect ( asWgsl ( testFunction ) ) . toMatchInlineSnapshot ( `
181+ expect ( tgpu . resolve ( [ testFunction ] ) ) . toMatchInlineSnapshot ( `
183182 "fn testFunction() {
184183 var defaultValue = array<array<f32, 1>, 2>();
185184 }"
@@ -195,7 +194,7 @@ describe('array', () => {
195194 return ;
196195 } ) ;
197196
198- expect ( asWgsl ( testFn ) ) . toMatchInlineSnapshot ( `
197+ expect ( tgpu . resolve ( [ testFn ] ) ) . toMatchInlineSnapshot ( `
199198 "fn testFn() {
200199 var myArray = array<u32, 1>(10u);
201200 var myClone = myArray;
@@ -213,7 +212,7 @@ describe('array', () => {
213212 return ;
214213 } ) ;
215214
216- expect ( asWgsl ( testFn ) ) . toMatchInlineSnapshot ( `
215+ expect ( tgpu . resolve ( [ testFn ] ) ) . toMatchInlineSnapshot ( `
217216 "fn testFn() {
218217 var myArrays = array<array<i32, 1>, 1>(array<i32, 1>(10i));
219218 var myClone = myArrays[0i];
@@ -227,7 +226,7 @@ describe('array', () => {
227226 const result = d . arrayOf ( d . f32 , 4 ) ( ) ;
228227 } ) ;
229228
230- expect ( asWgsl ( foo ) ) . toMatchInlineSnapshot ( `
229+ expect ( tgpu . resolve ( [ foo ] ) ) . toMatchInlineSnapshot ( `
231230 "fn foo() {
232231 var result = array<f32, 4>();
233232 }"
@@ -239,7 +238,7 @@ describe('array', () => {
239238 const result = d . arrayOf ( d . f32 ) ( 4 ) ( ) ;
240239 } ) ;
241240
242- expect ( asWgsl ( foo ) ) . toMatchInlineSnapshot ( `
241+ expect ( tgpu . resolve ( [ foo ] ) ) . toMatchInlineSnapshot ( `
243242 "fn foo() {
244243 var result = array<f32, 4>();
245244 }"
@@ -251,7 +250,7 @@ describe('array', () => {
251250 const result = d . arrayOf ( d . f32 , count ) ( ) ;
252251 } ) ;
253252
254- expect ( ( ) => asWgsl ( foo ) ) . toThrowErrorMatchingInlineSnapshot ( `
253+ expect ( ( ) => tgpu . resolve ( [ foo ] ) ) . toThrowErrorMatchingInlineSnapshot ( `
255254 [Error: Resolution of the following tree failed:
256255 - <root>
257256 - fn:foo
@@ -265,7 +264,7 @@ describe('array', () => {
265264 } ) ;
266265
267266 expect (
268- asWgsl ( ...Object . values ( testLayout . bound ) ) ,
267+ tgpu . resolve ( [ ...Object . values ( testLayout . bound ) ] ) ,
269268 ) . toMatchInlineSnapshot (
270269 `"@group(0) @binding(0) var<storage, read> testArray: array<u32>;"` ,
271270 ) ;
@@ -276,7 +275,7 @@ describe('array', () => {
276275 const result = d . arrayOf ( d . f32 , 4 ) ( [ 1 , 2 , 3 , 4 ] ) ;
277276 } ) ;
278277
279- expect ( asWgsl ( foo ) ) . toMatchInlineSnapshot ( `
278+ expect ( tgpu . resolve ( [ foo ] ) ) . toMatchInlineSnapshot ( `
280279 "fn foo() {
281280 var result = array<f32, 4>(1f, 2f, 3f, 4f);
282281 }"
@@ -288,7 +287,7 @@ describe('array', () => {
288287 const result = d . arrayOf ( d . f32 ) ( 4 ) ( [ 4 , 3 , 2 , 1 ] ) ;
289288 } ) ;
290289
291- expect ( asWgsl ( foo ) ) . toMatchInlineSnapshot ( `
290+ expect ( tgpu . resolve ( [ foo ] ) ) . toMatchInlineSnapshot ( `
292291 "fn foo() {
293292 var result = array<f32, 4>(4f, 3f, 2f, 1f);
294293 }"
@@ -302,7 +301,7 @@ describe('array', () => {
302301 const result = d . arrayOf ( d . f32 , arraySizeSlot . $ ) ( [ 4 , 3 , 2 , 1 ] ) ;
303302 } ) ;
304303
305- expect ( asWgsl ( foo ) ) . toMatchInlineSnapshot ( `
304+ expect ( tgpu . resolve ( [ foo ] ) ) . toMatchInlineSnapshot ( `
306305 "fn foo() {
307306 var result = array<f32, 4>(4f, 3f, 2f, 1f);
308307 }"
@@ -324,7 +323,7 @@ describe('array', () => {
324323 ) ;
325324 } ) ;
326325
327- expect ( asWgsl ( foo ) ) . toMatchInlineSnapshot ( `
326+ expect ( tgpu . resolve ( [ foo ] ) ) . toMatchInlineSnapshot ( `
328327 "fn foo() {
329328 var result = array<f32, 8>(0f, 1f, 2f, 3f, 4f, 5f, 6f, 7f);
330329 }"
@@ -349,7 +348,7 @@ describe('array.length', () => {
349348 }
350349 } ) ;
351350
352- expect ( asWgsl ( foo ) ) . toMatchInlineSnapshot ( `
351+ expect ( tgpu . resolve ( [ foo ] ) ) . toMatchInlineSnapshot ( `
353352 "@group(0) @binding(0) var<storage, read_write> values: array<f32>;
354353
355354 fn foo() {
@@ -378,7 +377,7 @@ describe('array.length', () => {
378377 }
379378 } ) ;
380379
381- expect ( asWgsl ( foo ) ) . toMatchInlineSnapshot ( `
380+ expect ( tgpu . resolve ( [ foo ] ) ) . toMatchInlineSnapshot ( `
382381 "@group(0) @binding(0) var<storage, read_write> values: array<f32, 128>;
383382
384383 fn foo() {
@@ -405,7 +404,7 @@ describe('array.length', () => {
405404 return arrayLength ( layout . $ . values ) ;
406405 } ) ;
407406
408- expect ( asWgsl ( testFn ) ) . toMatchInlineSnapshot ( `
407+ expect ( tgpu . resolve ( [ testFn ] ) ) . toMatchInlineSnapshot ( `
409408 "fn testFn() -> i32 {
410409 return 5;
411410 }"
@@ -425,7 +424,7 @@ describe('array.length', () => {
425424 return arrayLength ( layout . bound . values . value ) ;
426425 } ) ;
427426
428- expect ( asWgsl ( testFn ) ) . toMatchInlineSnapshot ( `
427+ expect ( tgpu . resolve ( [ testFn ] ) ) . toMatchInlineSnapshot ( `
429428 "@group(0) @binding(0) var<storage, read_write> values: array<f32>;
430429
431430 fn testFn() -> u32 {
0 commit comments