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 deleted file mode 100644 index 37bc2cc..0000000 --- a/test/control-std-union-without-xor/has-key-not-of-T-nor-of-U.fail.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { A_OR_B } from './setup' - -const test: A_OR_B = { lel: '' } // rejected diff --git a/test/control-std-union-without-xor/has-key-not-of-T-nor-of-U.spec.ts b/test/control-std-union-without-xor/has-key-not-of-T-nor-of-U.spec.ts new file mode 100644 index 0000000..042e6ef --- /dev/null +++ b/test/control-std-union-without-xor/has-key-not-of-T-nor-of-U.spec.ts @@ -0,0 +1,4 @@ +import { A_OR_B } from './setup' + +// @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 deleted file mode 100644 index edf25d9..0000000 --- a/test/control-std-union-without-xor/has-key-of-T-and-extra-random-key.fail.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { A_OR_B } from './setup' - -const test: A_OR_B = {a: '', lel: '' } // rejected diff --git a/test/control-std-union-without-xor/has-key-of-T-and-extra-random-key.spec.ts b/test/control-std-union-without-xor/has-key-of-T-and-extra-random-key.spec.ts new file mode 100644 index 0000000..8d25722 --- /dev/null +++ b/test/control-std-union-without-xor/has-key-of-T-and-extra-random-key.spec.ts @@ -0,0 +1,4 @@ +import { A_OR_B } from './setup' + +// @ts-expect-error +const test: A_OR_B = {a: '', lel: '' } diff --git a/test/control-std-union-without-xor/has-key-of-T-and-key-of-U.pass.spec.ts b/test/control-std-union-without-xor/has-key-of-T-and-key-of-U.spec.ts similarity index 100% rename from test/control-std-union-without-xor/has-key-of-T-and-key-of-U.pass.spec.ts rename to test/control-std-union-without-xor/has-key-of-T-and-key-of-U.spec.ts diff --git a/test/control-std-union-without-xor/has-keys-of-T.pass.spec.ts b/test/control-std-union-without-xor/has-keys-of-T.spec.ts similarity index 100% rename from test/control-std-union-without-xor/has-keys-of-T.pass.spec.ts rename to test/control-std-union-without-xor/has-keys-of-T.spec.ts diff --git a/test/control-std-union-without-xor/has-keys-of-U.pass.spec.ts b/test/control-std-union-without-xor/has-keys-of-U.spec.ts similarity index 100% rename from test/control-std-union-without-xor/has-keys-of-U.pass.spec.ts rename to test/control-std-union-without-xor/has-keys-of-U.spec.ts 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 deleted file mode 100644 index 7cfb2fd..0000000 --- a/test/control-std-union-without-xor/has-no-keys.fail.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { A_OR_B } from './setup' - -const test: A_OR_B = {} // rejected diff --git a/test/control-std-union-without-xor/has-no-keys.spec.ts b/test/control-std-union-without-xor/has-no-keys.spec.ts new file mode 100644 index 0000000..2c4bbee --- /dev/null +++ b/test/control-std-union-without-xor/has-no-keys.spec.ts @@ -0,0 +1,4 @@ +import { A_OR_B } from './setup' + +// @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 deleted file mode 100644 index 3fb266e..0000000 --- a/test/multiple-xored-types/has-keys-of-A-and-C.fail.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { A_XOR_B_XOR_C } from './setup' - -const test: A_XOR_B_XOR_C = { a: '', c: '' } // rejected diff --git a/test/multiple-xored-types/has-keys-of-A-and-C.spec.ts b/test/multiple-xored-types/has-keys-of-A-and-C.spec.ts new file mode 100644 index 0000000..ea1192c --- /dev/null +++ b/test/multiple-xored-types/has-keys-of-A-and-C.spec.ts @@ -0,0 +1,4 @@ +import { A_XOR_B_XOR_C } from './setup' + +// @ts-expect-error +const test: A_XOR_B_XOR_C = { a: '', c: '' } diff --git a/test/multiple-xored-types/has-keys-of-A.pass.spec.ts b/test/multiple-xored-types/has-keys-of-A.spec.ts similarity index 100% rename from test/multiple-xored-types/has-keys-of-A.pass.spec.ts rename to test/multiple-xored-types/has-keys-of-A.spec.ts diff --git a/test/multiple-xored-types/has-keys-of-B.pass.spec.ts b/test/multiple-xored-types/has-keys-of-B.spec.ts similarity index 100% rename from test/multiple-xored-types/has-keys-of-B.pass.spec.ts rename to test/multiple-xored-types/has-keys-of-B.spec.ts diff --git a/test/multiple-xored-types/has-keys-of-C.pass.spec.ts b/test/multiple-xored-types/has-keys-of-C.spec.ts similarity index 100% rename from test/multiple-xored-types/has-keys-of-C.pass.spec.ts rename to test/multiple-xored-types/has-keys-of-C.spec.ts diff --git a/test/multiple-xored-types/has-no-keys.fail.spec.ts b/test/multiple-xored-types/has-no-keys.fail.spec.ts deleted file mode 100644 index 6dede9c..0000000 --- a/test/multiple-xored-types/has-no-keys.fail.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { A_XOR_B_XOR_C } from './setup' - -const test: A_XOR_B_XOR_C = {} // rejected diff --git a/test/multiple-xored-types/has-no-keys.spec.ts b/test/multiple-xored-types/has-no-keys.spec.ts new file mode 100644 index 0000000..8455662 --- /dev/null +++ b/test/multiple-xored-types/has-no-keys.spec.ts @@ -0,0 +1,4 @@ +import { A_XOR_B_XOR_C } from './setup' + +// @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.spec.ts similarity index 75% rename from test/shared-and-xored-members/doesnt-have-rain-or-snow.fail.spec.ts rename to test/shared-and-xored-members/doesnt-have-rain-or-snow.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.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.spec.ts similarity index 78% rename from test/shared-and-xored-members/has-rain-and-snow-with-correct-keys.fail.spec.ts rename to test/shared-and-xored-members/has-rain-and-snow-with-correct-keys.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.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-corect-key-and-random-extra-key.fail.spec.ts b/test/shared-and-xored-members/has-rain-with-both-xored-keys.spec.ts similarity index 71% rename from test/shared-and-xored-members/has-rain-with-corect-key-and-random-extra-key.fail.spec.ts rename to test/shared-and-xored-members/has-rain-with-both-xored-keys.spec.ts index ec8749b..cd28c5e 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-both-xored-keys.spec.ts @@ -1,7 +1,8 @@ import { WeatherForecast } from './setup' const test: WeatherForecast = { - id: 123456, station: 'Acropolis Weather Reporter', - rain: { '1h': 1, lel: 'rofl' }, // fail + id: 123456, + // @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.spec.ts b/test/shared-and-xored-members/has-rain-with-corect-key-and-random-extra-key.spec.ts new file mode 100644 index 0000000..2366422 --- /dev/null +++ b/test/shared-and-xored-members/has-rain-with-corect-key-and-random-extra-key.spec.ts @@ -0,0 +1,8 @@ +import { WeatherForecast } from './setup' + +const test: WeatherForecast = { + id: 123456, + station: 'Acropolis Weather Reporter', + // @ts-expect-error + rain: { '1h': 1, lel: 'rofl' }, +} diff --git a/test/shared-and-xored-members/has-rain-with-correct-key.pass.spec.ts b/test/shared-and-xored-members/has-rain-with-correct-key.spec.ts similarity index 100% rename from test/shared-and-xored-members/has-rain-with-correct-key.pass.spec.ts rename to test/shared-and-xored-members/has-rain-with-correct-key.spec.ts 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.spec.ts similarity index 79% rename from test/shared-and-xored-members/has-rain-with-no-keys.fail.spec.ts rename to test/shared-and-xored-members/has-rain-with-no-keys.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.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 deleted file mode 100644 index 7f8f41e..0000000 --- a/test/shared-and-xored-members/has-rain-with-random-key.fail.spec.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { WeatherForecast } from './setup' - -const test: WeatherForecast = { - id: 123456, - station: 'Acropolis Weather Reporter', - rain: { '2h': 1 }, // rejected -} 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-random-key.spec.ts similarity index 75% rename from test/shared-and-xored-members/has-rain-with-both-xored-keys.fail.spec.ts rename to test/shared-and-xored-members/has-rain-with-random-key.spec.ts index ac5a00a..c904a0a 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-random-key.spec.ts @@ -1,7 +1,8 @@ import { WeatherForecast } from './setup' const test: WeatherForecast = { - station: 'Acropolis Weather Reporter', id: 123456, - rain: { '1h': 1, '3h': 3 }, // rejected + station: 'Acropolis Weather Reporter', + // @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 deleted file mode 100644 index 7628b3b..0000000 --- a/test/single-member-objects/has-key-not-of-T-nor-of-U.fail.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { A_XOR_B } from './setup' - -const test: A_XOR_B = { lel: '' } // rejected diff --git a/test/single-member-objects/has-key-not-of-T-nor-of-U.spec.ts b/test/single-member-objects/has-key-not-of-T-nor-of-U.spec.ts new file mode 100644 index 0000000..39fd074 --- /dev/null +++ b/test/single-member-objects/has-key-not-of-T-nor-of-U.spec.ts @@ -0,0 +1,4 @@ +import { A_XOR_B } from './setup' + +// @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 deleted file mode 100644 index 9725197..0000000 --- a/test/single-member-objects/has-key-of-T-and-extra-random-key.fail.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { A_XOR_B } from './setup' - -const test: A_XOR_B = {a: '', lel: '' } // rejected diff --git a/test/single-member-objects/has-key-of-T-and-extra-random-key.spec.ts b/test/single-member-objects/has-key-of-T-and-extra-random-key.spec.ts new file mode 100644 index 0000000..ce30e06 --- /dev/null +++ b/test/single-member-objects/has-key-of-T-and-extra-random-key.spec.ts @@ -0,0 +1,4 @@ +import { A_XOR_B } from './setup' + +// @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 deleted file mode 100644 index 21cb801..0000000 --- a/test/single-member-objects/has-key-of-T-and-key-of-U.fail.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { A_XOR_B } from './setup' - -const test: A_XOR_B = { a: '', b: '' } // rejected diff --git a/test/single-member-objects/has-key-of-T-and-key-of-U.spec.ts b/test/single-member-objects/has-key-of-T-and-key-of-U.spec.ts new file mode 100644 index 0000000..3750d63 --- /dev/null +++ b/test/single-member-objects/has-key-of-T-and-key-of-U.spec.ts @@ -0,0 +1,4 @@ +import { A_XOR_B } from './setup' + +// @ts-expect-error +const test: A_XOR_B = { a: '', b: '' } diff --git a/test/single-member-objects/has-keys-of-T.pass.spec.ts b/test/single-member-objects/has-keys-of-T.spec.ts similarity index 100% rename from test/single-member-objects/has-keys-of-T.pass.spec.ts rename to test/single-member-objects/has-keys-of-T.spec.ts diff --git a/test/single-member-objects/has-keys-of-U.pass.spec.ts b/test/single-member-objects/has-keys-of-U.spec.ts similarity index 100% rename from test/single-member-objects/has-keys-of-U.pass.spec.ts rename to test/single-member-objects/has-keys-of-U.spec.ts diff --git a/test/single-member-objects/has-no-keys.fail.spec.ts b/test/single-member-objects/has-no-keys.fail.spec.ts deleted file mode 100644 index c3c7d78..0000000 --- a/test/single-member-objects/has-no-keys.fail.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { A_XOR_B } from './setup' - -const test: A_XOR_B = {} // rejected diff --git a/test/single-member-objects/has-no-keys.spec.ts b/test/single-member-objects/has-no-keys.spec.ts new file mode 100644 index 0000000..c062576 --- /dev/null +++ b/test/single-member-objects/has-no-keys.spec.ts @@ -0,0 +1,4 @@ +import { A_XOR_B } from './setup' + +// @ts-expect-error +const test: A_XOR_B = {}