Skip to content

Commit

Permalink
Use t.execution for exhaustiveness error tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn committed Feb 14, 2024
1 parent e088115 commit c83a120
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ test('assert()', (t) => {
t.exception(() => assert(false, 'uh oh'), /uh oh/)
})

test('exhaustivenessError', () => {
test('exhaustivenessError', (t) => {
const bools = [true, false]
bools.forEach((bool) => {
switch (bool) {
case true:
case false:
break
default:
throw new ExhaustivenessError(bool)
}
t.execution(() => {
bools.forEach((bool) => {
switch (bool) {
case true:
case false:
break
default:
throw new ExhaustivenessError(bool)
}
})
})
})

Expand Down

0 comments on commit c83a120

Please sign in to comment.