Skip to content

Commit ce88d74

Browse files
committed
Replace vitest
1 parent 69ad99f commit ce88d74

20 files changed

+179
-190
lines changed

wesl/test/BindWESL.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { test } from "vitest";
21
import { scopeToStringLong } from "../debug/ScopeToString.ts";
32
import { bindTest } from "./TestUtil.ts";
43
import { assertSnapshot } from "@std/testing/snapshot";
54

6-
test("nested scopes binding", async (t) => {
5+
Deno.test("nested scopes binding", async (t) => {
76
const src = `
87
fn main() {
98
let bar = 72;
@@ -22,7 +21,7 @@ test("nested scopes binding", async (t) => {
2221
await assertSnapshot(t, scopeToStringLong(ast.rootScope));
2322
});
2423

25-
test("@location attribute const", async (t) => {
24+
Deno.test("@location attribute const", async (t) => {
2625
const src = `
2726
const pos = 0;
2827

wesl/test/ConditionLinking.test.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { test } from "vitest";
21
import { testLink } from "./TestLink.ts";
32

43
// LATER move these to cond cases? (or drop if duplicative)
54

6-
test("conditional statement", async () => {
5+
Deno.test("conditional statement", async () => {
76
const app = `
87
fn main() {
98
@if(false) let x = 1;
@@ -17,7 +16,7 @@ test("conditional statement", async () => {
1716
await testLink({ app: app }, "app", expectWgsl);
1817
});
1918

20-
test("conditional compound statement", async () => {
19+
Deno.test("conditional compound statement", async () => {
2120
const app = `
2221
fn main() {
2322
@if(false) {
@@ -33,7 +32,7 @@ test("conditional compound statement", async () => {
3332
await testLink({ app: app }, "app", expectWgsl);
3433
});
3534

36-
test("conditional local variables", async () => {
35+
Deno.test("conditional local variables", async () => {
3736
const app = `
3837
fn main() {
3938
@if(true) var x = 1;
@@ -49,7 +48,7 @@ test("conditional local variables", async () => {
4948
await testLink({ app: app }, "app", expectWgsl);
5049
});
5150

52-
test("conditional binding ", async () => {
51+
Deno.test("conditional binding ", async () => {
5352
const app = `
5453
fn main() {
5554
@if(true) var x = 1;
@@ -67,7 +66,7 @@ test("conditional binding ", async () => {
6766
await testLink({ app: app }, "app", expectWgsl);
6867
});
6968

70-
test("conditional binding references", async () => {
69+
Deno.test("conditional binding references", async () => {
7170
const app = `
7271
import package::file1::b;
7372
@@ -92,7 +91,7 @@ const b = 9;
9291
await testLink({ app, file1 }, "app", expectWgsl);
9392
});
9493

95-
test("@if(MOBILE) statement", async () => {
94+
Deno.test("@if(MOBILE) statement", async () => {
9695
const app = `
9796
fn main() {
9897
@if(MOBILE) let x = 1;
@@ -108,7 +107,7 @@ test("@if(MOBILE) statement", async () => {
108107
await testLink({ app: app }, "app", expectWgsl);
109108
});
110109

111-
test("@if(MOBILE) const", async () => {
110+
Deno.test("@if(MOBILE) const", async () => {
112111
const app = `
113112
fn main() {
114113
let y = package::util::x;
@@ -128,7 +127,7 @@ test("@if(MOBILE) const", async () => {
128127
await testLink({ app, util }, "app", expectWgsl);
129128
});
130129

131-
test("@if(MOBILE) override", async () => {
130+
Deno.test("@if(MOBILE) override", async () => {
132131
const app = `
133132
fn main() {
134133
let y = package::util::x;
@@ -148,7 +147,7 @@ test("@if(MOBILE) override", async () => {
148147
await testLink({ app, util }, "app", expectWgsl);
149148
});
150149

151-
test("@if(MOBILE) global var", async () => {
150+
Deno.test("@if(MOBILE) global var", async () => {
152151
const app = `
153152
fn main() {
154153
let y = package::util::x;

wesl/test/ErrorLogging.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import { type expect, test } from "vitest";
21
import { linkWithLogQuietly } from "./TestUtil.ts";
32
import { assertSnapshot } from "@std/testing/snapshot";
43

5-
test("unresolved identifier", async (t) => {
4+
Deno.test("unresolved identifier", async (t) => {
65
const src = `
76
fn main() { x = 7; }
87
`;
98
const { log } = await linkWithLogQuietly(src);
109
await assertSnapshot(t, log);
1110
});
1211

13-
test("conditionally empty struct", async (t) => {
12+
Deno.test("conditionally empty struct", async (t) => {
1413
const src = `
1514
struct Empty {
1615
@if(false) u: u32,

wesl/test/Expression.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { eof, seq } from "@wesl/mini-parse";
2-
import { expect, test } from "vitest";
2+
import { expect } from "@std/expect";
33
import { expression } from "../parse/WeslExpression.ts";
44
import { testAppParse } from "./TestUtil.ts";
55

6-
test("parse number", () => {
6+
Deno.test("parse number", () => {
77
const src = `3`;
88
const { parsed } = testAppParse(seq(expression, eof), src);
99
expect(parsed).not.toBeNull();
1010
});
1111

12-
test("parse comparisons with && ||", () => {
12+
Deno.test("parse comparisons with && ||", () => {
1313
const src = `a<3 && 4>(5)`;
1414
const { parsed } = testAppParse(seq(expression, eof), src);
1515
expect(parsed).not.toBeNull();
1616
});
1717

18-
test("parse vec templated type", () => {
18+
Deno.test("parse vec templated type", () => {
1919
const src = `vec2<f32>`;
2020
const { parsed } = testAppParse(seq(expression, eof), src);
2121
expect(parsed).not.toBeNull();

wesl/test/FlattenTreeImport.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { test } from "vitest";
21
import type { ImportCollection, ImportStatement } from "../AbstractElems.ts";
32
import { flattenTreeImport } from "../FlattenTreeImport.ts";
43
import { assertSnapshot } from "@std/testing/snapshot";
54

6-
test("complex tree import", async (t) => {
5+
Deno.test("complex tree import", async (t) => {
76
const list: ImportCollection = {
87
kind: "import-collection",
98
subtrees: [

wesl/test/Linker.test.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { expectTrimmedMatch } from "@wesl/mini-parse/vitest-util";
2-
import { test } from "vitest";
32
import { linkTest } from "./TestUtil.ts";
43

5-
test("link global var", async () => {
4+
Deno.test("link global var", async () => {
65
const src = `var x: i32 = 1;`;
76
const result = await linkTest(src);
87
expectTrimmedMatch(result, src);
98
});
109

11-
test("link an alias", async () => {
10+
Deno.test("link an alias", async () => {
1211
const src = `
1312
alias Num = f32;
1413
@@ -18,7 +17,7 @@ test("link an alias", async () => {
1817
expectTrimmedMatch(result, src);
1918
});
2019

21-
test("link a const_assert", async () => {
20+
Deno.test("link a const_assert", async () => {
2221
const src = `
2322
var x = 1;
2423
var y = 2;
@@ -28,7 +27,7 @@ test("link a const_assert", async () => {
2827
expectTrimmedMatch(result, src);
2928
});
3029

31-
test("link a struct", async () => {
30+
Deno.test("link a struct", async () => {
3231
const src = `
3332
struct Point {
3433
x: i32,
@@ -39,7 +38,7 @@ test("link a struct", async () => {
3938
expectTrimmedMatch(result, src);
4039
});
4140

42-
test("link a fn", async () => {
41+
Deno.test("link a fn", async () => {
4342
const src = `
4443
fn foo(x: i32, y: u32) -> f32 {
4544
return 1.0;
@@ -48,15 +47,15 @@ test("link a fn", async () => {
4847
expectTrimmedMatch(result, src);
4948
});
5049

51-
test("handle a ptr type", async () => {
50+
Deno.test("handle a ptr type", async () => {
5251
const src = `
5352
fn uint_bitfieldExtract_u1_i1_i1_(value: ptr<function, u32>, bits: ptr<function, i32>) -> u32 { }
5453
`;
5554
const result = await linkTest(src);
5655
expectTrimmedMatch(result, src);
5756
});
5857

59-
test("struct after var", async () => {
58+
Deno.test("struct after var", async () => {
6059
const src = `
6160
var config: TwoPassConfig;
6261
@@ -66,7 +65,7 @@ test("struct after var", async () => {
6665
expectTrimmedMatch(result, src);
6766
});
6867

69-
test("type inside fn with same name as fn", async () => {
68+
Deno.test("type inside fn with same name as fn", async () => {
7069
// illegal but shouldn't hang
7170
const src = `
7271
fn foo() {
@@ -78,7 +77,7 @@ test("type inside fn with same name as fn", async () => {
7877
expectTrimmedMatch(result, src);
7978
});
8079

81-
test("call cross reference", async () => {
80+
Deno.test("call cross reference", async () => {
8281
const src = `
8382
fn foo() {
8483
bar();
@@ -93,7 +92,7 @@ test("call cross reference", async () => {
9392
expectTrimmedMatch(result, src);
9493
});
9594

96-
test("struct self reference", async () => {
95+
Deno.test("struct self reference", async () => {
9796
const src = `
9897
struct A {
9998
a: A,
@@ -106,13 +105,13 @@ test("struct self reference", async () => {
106105
expectTrimmedMatch(result, src);
107106
});
108107

109-
test("parse texture_storage_2d with texture format in typical type position", async () => {
108+
Deno.test("parse texture_storage_2d with texture format in typical type position", async () => {
110109
const src = `var t: texture_storage_2d<rgba8unorm, write>;`;
111110
const result = await linkTest(src);
112111
expectTrimmedMatch(result, src);
113112
});
114113

115-
test("struct member ref with extra component_or_swizzle", async () => {
114+
Deno.test("struct member ref with extra component_or_swizzle", async () => {
116115
const src = `
117116
struct C { p: P }
118117
struct P { x: u32 }

wesl/test/Mangling.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { expectTrimmedMatch } from "@wesl/mini-parse/vitest-util";
2-
import { test } from "vitest";
32
import { link } from "../Linker.ts";
43
import { underscoreMangle } from "../Mangler.ts";
54
import { linkTestOpts } from "./TestUtil.ts";
65

7-
test("underscoreMangle", async () => {
6+
Deno.test("underscoreMangle", async () => {
87
const main = `
98
import package::file1::bar;
109
fn main() { bar(); }
@@ -21,7 +20,7 @@ fn main() { bar(); }
2120
expectTrimmedMatch(linked, expected);
2221
});
2322

24-
test("underscoreMangle longer ident", async () => {
23+
Deno.test("underscoreMangle longer ident", async () => {
2524
const main = `
2625
import package::container::file1::bar;
2726
fn main() { bar(); }

wesl/test/ParseComments.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
import { expectNoLog } from "@wesl/mini-parse/test-util";
2-
3-
import { test } from "vitest";
42
import { astToString } from "../debug/ASTtoString.ts";
53
import { parseWESL } from "./TestUtil.ts";
64
import { assertSnapshot } from "@std/testing/snapshot";
75

8-
test("parse fn with line comment", async (t) => {
6+
Deno.test("parse fn with line comment", async (t) => {
97
const src = `
108
fn binaryOp() { // binOpImpl
119
}`;
1210
const parsed = parseWESL(src);
1311
await assertSnapshot(t, astToString(parsed.moduleElem));
1412
});
1513

16-
test("parse empty line comment", () => {
14+
Deno.test("parse empty line comment", () => {
1715
const src = `
1816
var workgroupThreads= 4; //
1917
`;
2018
expectNoLog(() => parseWESL(src));
2119
});
2220

23-
test("parse line comment with #replace", () => {
21+
Deno.test("parse line comment with #replace", () => {
2422
const src = `
2523
const workgroupThreads= 4; // #replace 4=workgroupThreads
2624
`;

wesl/test/ParseConditions.test.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import { type expect, test } from "vitest";
21
import { astToString } from "../debug/ASTtoString.ts";
32
import { parseTest } from "./TestUtil.ts";
43
import { assertSnapshot } from "@std/testing/snapshot";
54

6-
test("parse complex condition", async (t) => {
5+
Deno.test("parse complex condition", async (t) => {
76
const ast = parseTest("@if(true || (!foo&&!!false) )\nfn a() {}");
87
await assertSnapshot(t, astToString(ast.moduleElem));
98
});
109

11-
test("@if(false) enable f16", async (t) => {
10+
Deno.test("@if(false) enable f16", async (t) => {
1211
const src = `
1312
@if(false) enable f16;
1413
`;
@@ -17,7 +16,7 @@ test("@if(false) enable f16", async (t) => {
1716
await assertSnapshot(t, astString);
1817
});
1918

20-
test("@if(false) const_assert true;", async (t) => {
19+
Deno.test("@if(false) const_assert true;", async (t) => {
2120
const src = `
2221
@if(false) const_assert true;
2322
`;
@@ -26,7 +25,7 @@ test("@if(false) const_assert true;", async (t) => {
2625
await assertSnapshot(t, astString);
2726
});
2827

29-
test("@if(true) var x = 7", async (t) => {
28+
Deno.test("@if(true) var x = 7", async (t) => {
3029
const src = `
3130
@if(true) var x = 7;
3231
`;
@@ -35,7 +34,7 @@ test("@if(true) var x = 7", async (t) => {
3534
await assertSnapshot(t, astString);
3635
});
3736

38-
test("conditional statement", async (t) => {
37+
Deno.test("conditional statement", async (t) => {
3938
const src = `
4039
fn main() {
4140
var x = 1;
@@ -47,7 +46,7 @@ test("conditional statement", async (t) => {
4746
await assertSnapshot(t, astString);
4847
});
4948

50-
test("compound statement", async (t) => {
49+
Deno.test("compound statement", async (t) => {
5150
const src = `
5251
fn main() {
5352
@if(false) {
@@ -60,7 +59,7 @@ test("compound statement", async (t) => {
6059
await assertSnapshot(t, astString);
6160
});
6261

63-
test("conditional local var", async (t) => {
62+
Deno.test("conditional local var", async (t) => {
6463
const src = `
6564
fn main() {
6665
@if(true) var x = 1;
@@ -71,7 +70,7 @@ test("conditional local var", async (t) => {
7170
await assertSnapshot(t, astString);
7271
});
7372

74-
test("@if(MOBILE) const x = 1", async (t) => {
73+
Deno.test("@if(MOBILE) const x = 1", async (t) => {
7574
const src = `
7675
@if(MOBILE) const x = 1;
7776
`;
@@ -80,7 +79,7 @@ test("@if(MOBILE) const x = 1", async (t) => {
8079
await assertSnapshot(t, astString);
8180
});
8281

83-
// test("", () => {
82+
// Deno.test("", () => {
8483
// const src = `
8584
// `;
8685
// const ast = parseTest(src);

0 commit comments

Comments
 (0)