-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: reject if closed state is incorrect (#42)
Some methods, like `addCore()`, now throw if called after calling `close()`. `unlink()` is the opposite, and should only be called after the indexer is closed. This is arguably a breaking change, but I feel that changing undefined behavior is not breaking.
- Loading branch information
Showing
6 changed files
with
226 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// @ts-check | ||
const test = require('node:test') | ||
const assert = require('node:assert/strict') | ||
const { ExhaustivenessError } = require('../../lib/utils.js') | ||
|
||
test('ExhaustivenessError', () => { | ||
const bools = [true, false] | ||
assert.doesNotThrow(() => { | ||
bools.forEach((bool) => { | ||
switch (bool) { | ||
case true: | ||
case false: | ||
break | ||
default: | ||
throw new ExhaustivenessError(bool) | ||
} | ||
}) | ||
}) | ||
}) |