Repairs to tests

This commit is contained in:
Tony Garnock-Jones 2021-12-08 14:06:16 +01:00
parent 6576f30639
commit 43f31b9a78
3 changed files with 9 additions and 9 deletions

View File

@ -28,7 +28,7 @@ expect.extend({
return { message: () => preserves`expected an exception not matching the filter`,
pass: true };
} else {
return { message: () => preserves`expected an exception matching the filter: ${e.constructor.name}`,
return { message: () => preserves`expected an exception matching the filter: ${(e as any)?.constructor?.name}`,
pass: false };
}
}

View File

@ -32,8 +32,8 @@ describe('checker', () => {
definitions: {
ExtensibleRecord:
<rec <lit foo>
<tuple* [<named a <atom String>>, <named b <atom String>>]
<named extra <seqof any>>>>}}>`).next());
<tuplePrefix [<named a <atom String>>, <named b <atom String>>]
<named extra <seqof any>>>>}}>`).next());
});
it('non-invertibility tail', () => {
expect(() => readSchema(
@ -51,11 +51,11 @@ describe('checker', () => {
expect(() => readSchema('version 1 . A = { x: @a string , y: @a string }.'))
.toThrow(/duplicate binding named "a" in entry y in dictionary in A/);
});
it('complains about duplicates in tuple*s', () => {
it('complains about duplicates in tuplePrefixes', () => {
expect(() => readSchema('version 1 . A = [@a string @b string @a int @rest any ...].'))
.toThrow(/duplicate binding named "a" in item 2 of A/);
});
it('complains about duplicates in tuple* tails', () => {
it('complains about duplicates in tuplePrefix tails', () => {
expect(() => readSchema('version 1 . A = [@a string @b string @c int @a any ...].'))
.toThrow(/duplicate binding named "a" in tail of A/);
});
@ -113,7 +113,7 @@ describe('checker', () => {
`version 1 .
AAA = <a @a string @a int>.
ABC = <a @b string @c int>.
A = @x AAA & @y ABC.`))
A = @x AAA & @y ABC .`))
.toThrow(/in item 1 of fields of AAA/);
});
it('is OK with seeming- but non-duplicates across named branches', () => {
@ -121,7 +121,7 @@ describe('checker', () => {
`version 1 .
AAA = <a @a string @b int>.
ABC = <a @a string @c int>.
A = @x AAA & @y ABC.`))
A = @x AAA & @y ABC .`))
.not.toBeNull();
});
it('complains about duplicate branch names', () => {
@ -129,7 +129,7 @@ describe('checker', () => {
`version 1 .
AAB = <a @a string @b int>.
ACD = <a @c string @d int>.
A = @x AAB & @x ACD.`))
A = @x AAB & @x ACD .`))
.toThrow(/in A/);
});
});

View File

@ -27,7 +27,7 @@ expect.extend({
return { message: () => preserves`expected an exception not matching the filter`,
pass: true };
} else {
return { message: () => preserves`expected an exception matching the filter: ${e.constructor.name}`,
return { message: () => preserves`expected an exception matching the filter: ${(e as any)?.constructor?.name}`,
pass: false };
}
}