copied set implementations from MultiFlag JS
This commit is contained in:
12
node/tests/_archive/flag.test.ts
Normal file
12
node/tests/_archive/flag.test.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { NumberBitflagSet, ForeignFlagError } from '@module'
|
||||
|
||||
test('cannot create a flag with a foreign parent', () => {
|
||||
const flags = new NumberBitflagSet()
|
||||
const flagA = flags.flag(1)
|
||||
|
||||
const otherFlags = new NumberBitflagSet()
|
||||
const flagX = otherFlags.flag(1)
|
||||
|
||||
flags.flag(2, flagA) // OK
|
||||
expect(() => flags.flag(4, flagX)).toThrow(ForeignFlagError)
|
||||
})
|
||||
Reference in New Issue
Block a user