Skip to content

Commit 004aa0d

Browse files
committed
Chore: trivial
1 parent 4bcab0b commit 004aa0d

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

test/parser.ts

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ describe("parseRegExpLiteral function:", () => {
1919
const options = fixture.options
2020

2121
describe(`${filename} (options=${JSON.stringify(options)})`, () => {
22+
if (filename.indexOf("-valid") !== -1) {
23+
it("should not contain any invalid test case", () => {
24+
for (const source of Object.keys(fixture.patterns)) {
25+
const result = fixture.patterns[source]
26+
assert("ast" in result, `${source} is invalid`)
27+
}
28+
})
29+
} else if (filename.indexOf("-invalid") !== -1) {
30+
it("should not contain any valid test case", () => {
31+
for (const source of Object.keys(fixture.patterns)) {
32+
const result = fixture.patterns[source]
33+
assert("error" in result, `${source} is valid`)
34+
}
35+
})
36+
}
37+
2238
for (const source of Object.keys(fixture.patterns)) {
2339
const result = fixture.patterns[source]
2440
if ("ast" in result) {
@@ -58,27 +74,3 @@ describe("parseRegExpLiteral function:", () => {
5874
assert.deepStrictEqual(actual, expected)
5975
})
6076
})
61-
62-
for (const filename of Object.keys(Fixtures)) {
63-
const fixture = Fixtures[filename]
64-
65-
if (filename.indexOf("-valid") !== -1) {
66-
describe(filename, () => {
67-
it("should not contain any invalid test case", () => {
68-
for (const source of Object.keys(fixture.patterns)) {
69-
const result = fixture.patterns[source]
70-
assert("ast" in result, `${source} is invalid`)
71-
}
72-
})
73-
})
74-
} else if (filename.indexOf("-invalid") !== -1) {
75-
describe(filename, () => {
76-
it("should not contain any valid test case", () => {
77-
for (const source of Object.keys(fixture.patterns)) {
78-
const result = fixture.patterns[source]
79-
assert("error" in result, `${source} is valid`)
80-
}
81-
})
82-
})
83-
}
84-
}

0 commit comments

Comments
 (0)