diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 740ed30..c9f164e 100644 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -7,7 +7,7 @@ printFileFailedTest () { TESTS_FAILED=false # all these tests must pass compilation -for FILE in $(ls test/**/*.pass.spec.ts) +for FILE in $(ls test/**/*.spec.ts) do tsc --noEmit $FILE > /dev/null if [ $? -ne 0 ]; then @@ -16,16 +16,6 @@ do fi done -# each of these tests must fail compilation -for FILE in $(ls test/**/*.fail.spec.ts) -do - tsc --noEmit $FILE > /dev/null - if [ $? -eq 0 ]; then - TESTS_FAILED=true - printFileFailedTest $FILE - fi -done - if $TESTS_FAILED; then exit 1 else diff --git a/test/control-std-union-without-xor/has-key-not-of-T-nor-of-U.fail.spec.ts b/test/control-std-union-without-xor/has-key-not-of-T-nor-of-U.fail.spec.ts index 37bc2cc..042e6ef 100644 --- a/test/control-std-union-without-xor/has-key-not-of-T-nor-of-U.fail.spec.ts +++ b/test/control-std-union-without-xor/has-key-not-of-T-nor-of-U.fail.spec.ts @@ -1,3 +1,4 @@ import { A_OR_B } from './setup' -const test: A_OR_B = { lel: '' } // rejected +// @ts-expect-error +const test: A_OR_B = { lel: '' } \ No newline at end of file diff --git a/test/control-std-union-without-xor/has-key-of-T-and-extra-random-key.fail.spec.ts b/test/control-std-union-without-xor/has-key-of-T-and-extra-random-key.fail.spec.ts index edf25d9..8d25722 100644 --- a/test/control-std-union-without-xor/has-key-of-T-and-extra-random-key.fail.spec.ts +++ b/test/control-std-union-without-xor/has-key-of-T-and-extra-random-key.fail.spec.ts @@ -1,3 +1,4 @@ import { A_OR_B } from './setup' -const test: A_OR_B = {a: '', lel: '' } // rejected +// @ts-expect-error +const test: A_OR_B = {a: '', lel: '' } diff --git a/test/control-std-union-without-xor/has-no-keys.fail.spec.ts b/test/control-std-union-without-xor/has-no-keys.fail.spec.ts index 7cfb2fd..2c4bbee 100644 --- a/test/control-std-union-without-xor/has-no-keys.fail.spec.ts +++ b/test/control-std-union-without-xor/has-no-keys.fail.spec.ts @@ -1,3 +1,4 @@ import { A_OR_B } from './setup' -const test: A_OR_B = {} // rejected +// @ts-expect-error +const test: A_OR_B = {} diff --git a/test/multiple-xored-types/has-keys-of-A-and-C.fail.spec.ts b/test/multiple-xored-types/has-keys-of-A-and-C.fail.spec.ts index 3fb266e..ea1192c 100644 --- a/test/multiple-xored-types/has-keys-of-A-and-C.fail.spec.ts +++ b/test/multiple-xored-types/has-keys-of-A-and-C.fail.spec.ts @@ -1,3 +1,4 @@ import { A_XOR_B_XOR_C } from './setup' -const test: A_XOR_B_XOR_C = { a: '', c: '' } // rejected +// @ts-expect-error +const test: A_XOR_B_XOR_C = { a: '', c: '' } diff --git a/test/multiple-xored-types/has-no-keys.fail.spec.ts b/test/multiple-xored-types/has-no-keys.fail.spec.ts index 6dede9c..8455662 100644 --- a/test/multiple-xored-types/has-no-keys.fail.spec.ts +++ b/test/multiple-xored-types/has-no-keys.fail.spec.ts @@ -1,3 +1,4 @@ import { A_XOR_B_XOR_C } from './setup' -const test: A_XOR_B_XOR_C = {} // rejected +// @ts-expect-error +const test: A_XOR_B_XOR_C = {} diff --git a/test/shared-and-xored-members/doesnt-have-rain-or-snow.fail.spec.ts b/test/shared-and-xored-members/doesnt-have-rain-or-snow.fail.spec.ts index 3ff3794..49861b3 100644 --- a/test/shared-and-xored-members/doesnt-have-rain-or-snow.fail.spec.ts +++ b/test/shared-and-xored-members/doesnt-have-rain-or-snow.fail.spec.ts @@ -3,5 +3,6 @@ import { WeatherForecast } from './setup' const test: WeatherForecast = { id: 123456, station: 'Acropolis Weather Reporter', - lel: { '1h': 1 }, // rejected + // @ts-expect-error + lel: { '1h': 1 }, } diff --git a/test/shared-and-xored-members/has-rain-and-snow-with-correct-keys.fail.spec.ts b/test/shared-and-xored-members/has-rain-and-snow-with-correct-keys.fail.spec.ts index 2af57e5..776672b 100644 --- a/test/shared-and-xored-members/has-rain-and-snow-with-correct-keys.fail.spec.ts +++ b/test/shared-and-xored-members/has-rain-and-snow-with-correct-keys.fail.spec.ts @@ -1,8 +1,9 @@ import { WeatherForecast } from './setup' +// @ts-expect-error const test: WeatherForecast = { id: 123456, station: 'Acropolis Weather Reporter', rain: { '1h': 1 }, - snow: { '3h': 3 }, // rejected + snow: { '3h': 3 }, } diff --git a/test/shared-and-xored-members/has-rain-with-both-xored-keys.fail.spec.ts b/test/shared-and-xored-members/has-rain-with-both-xored-keys.fail.spec.ts index ac5a00a..cd28c5e 100644 --- a/test/shared-and-xored-members/has-rain-with-both-xored-keys.fail.spec.ts +++ b/test/shared-and-xored-members/has-rain-with-both-xored-keys.fail.spec.ts @@ -3,5 +3,6 @@ import { WeatherForecast } from './setup' const test: WeatherForecast = { station: 'Acropolis Weather Reporter', id: 123456, - rain: { '1h': 1, '3h': 3 }, // rejected + // @ts-expect-error + rain: { '1h': 1, '3h': 3 }, } diff --git a/test/shared-and-xored-members/has-rain-with-corect-key-and-random-extra-key.fail.spec.ts b/test/shared-and-xored-members/has-rain-with-corect-key-and-random-extra-key.fail.spec.ts index ec8749b..2366422 100644 --- a/test/shared-and-xored-members/has-rain-with-corect-key-and-random-extra-key.fail.spec.ts +++ b/test/shared-and-xored-members/has-rain-with-corect-key-and-random-extra-key.fail.spec.ts @@ -3,5 +3,6 @@ import { WeatherForecast } from './setup' const test: WeatherForecast = { id: 123456, station: 'Acropolis Weather Reporter', - rain: { '1h': 1, lel: 'rofl' }, // fail + // @ts-expect-error + rain: { '1h': 1, lel: 'rofl' }, } diff --git a/test/shared-and-xored-members/has-rain-with-no-keys.fail.spec.ts b/test/shared-and-xored-members/has-rain-with-no-keys.fail.spec.ts index 2056a24..7014706 100644 --- a/test/shared-and-xored-members/has-rain-with-no-keys.fail.spec.ts +++ b/test/shared-and-xored-members/has-rain-with-no-keys.fail.spec.ts @@ -3,5 +3,6 @@ import { WeatherForecast } from './setup' const test: WeatherForecast = { id: 123456, station: 'Acropolis Weather Reporter', - rain: {}, // rejected + // @ts-expect-error + rain: {}, } diff --git a/test/shared-and-xored-members/has-rain-with-random-key.fail.spec.ts b/test/shared-and-xored-members/has-rain-with-random-key.fail.spec.ts index 7f8f41e..c904a0a 100644 --- a/test/shared-and-xored-members/has-rain-with-random-key.fail.spec.ts +++ b/test/shared-and-xored-members/has-rain-with-random-key.fail.spec.ts @@ -3,5 +3,6 @@ import { WeatherForecast } from './setup' const test: WeatherForecast = { id: 123456, station: 'Acropolis Weather Reporter', - rain: { '2h': 1 }, // rejected + // @ts-expect-error + rain: { '2h': 1 }, } diff --git a/test/single-member-objects/has-key-not-of-T-nor-of-U.fail.spec.ts b/test/single-member-objects/has-key-not-of-T-nor-of-U.fail.spec.ts index 7628b3b..39fd074 100644 --- a/test/single-member-objects/has-key-not-of-T-nor-of-U.fail.spec.ts +++ b/test/single-member-objects/has-key-not-of-T-nor-of-U.fail.spec.ts @@ -1,3 +1,4 @@ import { A_XOR_B } from './setup' -const test: A_XOR_B = { lel: '' } // rejected +// @ts-expect-error +const test: A_XOR_B = { lel: '' } diff --git a/test/single-member-objects/has-key-of-T-and-extra-random-key.fail.spec.ts b/test/single-member-objects/has-key-of-T-and-extra-random-key.fail.spec.ts index 9725197..ce30e06 100644 --- a/test/single-member-objects/has-key-of-T-and-extra-random-key.fail.spec.ts +++ b/test/single-member-objects/has-key-of-T-and-extra-random-key.fail.spec.ts @@ -1,3 +1,4 @@ import { A_XOR_B } from './setup' -const test: A_XOR_B = {a: '', lel: '' } // rejected +// @ts-expect-error +const test: A_XOR_B = {a: '', lel: '' } diff --git a/test/single-member-objects/has-key-of-T-and-key-of-U.fail.spec.ts b/test/single-member-objects/has-key-of-T-and-key-of-U.fail.spec.ts index 21cb801..3750d63 100644 --- a/test/single-member-objects/has-key-of-T-and-key-of-U.fail.spec.ts +++ b/test/single-member-objects/has-key-of-T-and-key-of-U.fail.spec.ts @@ -1,3 +1,4 @@ import { A_XOR_B } from './setup' -const test: A_XOR_B = { a: '', b: '' } // rejected +// @ts-expect-error +const test: A_XOR_B = { a: '', b: '' } diff --git a/test/single-member-objects/has-no-keys.fail.spec.ts b/test/single-member-objects/has-no-keys.fail.spec.ts index c3c7d78..c062576 100644 --- a/test/single-member-objects/has-no-keys.fail.spec.ts +++ b/test/single-member-objects/has-no-keys.fail.spec.ts @@ -1,3 +1,4 @@ import { A_XOR_B } from './setup' -const test: A_XOR_B = {} // rejected +// @ts-expect-error +const test: A_XOR_B = {}