Skip to content

Commit

Permalink
Merge pull request #25 from maninak/test/24-revisit-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
maninak authored Sep 11, 2023
2 parents 6f8e363 + 70d8c2c commit 197fbe3
Show file tree
Hide file tree
Showing 35 changed files with 57 additions and 52 deletions.
12 changes: 1 addition & 11 deletions scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { A_OR_B } from './setup'

// @ts-expect-error
const test: A_OR_B = { lel: '' }

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { A_OR_B } from './setup'

// @ts-expect-error
const test: A_OR_B = {a: '', lel: '' }
3 changes: 0 additions & 3 deletions test/control-std-union-without-xor/has-no-keys.fail.spec.ts

This file was deleted.

4 changes: 4 additions & 0 deletions test/control-std-union-without-xor/has-no-keys.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { A_OR_B } from './setup'

// @ts-expect-error
const test: A_OR_B = {}
3 changes: 0 additions & 3 deletions test/multiple-xored-types/has-keys-of-A-and-C.fail.spec.ts

This file was deleted.

4 changes: 4 additions & 0 deletions test/multiple-xored-types/has-keys-of-A-and-C.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { A_XOR_B_XOR_C } from './setup'

// @ts-expect-error
const test: A_XOR_B_XOR_C = { a: '', c: '' }
3 changes: 0 additions & 3 deletions test/multiple-xored-types/has-no-keys.fail.spec.ts

This file was deleted.

4 changes: 4 additions & 0 deletions test/multiple-xored-types/has-no-keys.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { A_XOR_B_XOR_C } from './setup'

// @ts-expect-error
const test: A_XOR_B_XOR_C = {}
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
}
Original file line number Diff line number Diff line change
@@ -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 },
}
Original file line number Diff line number Diff line change
@@ -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 },
}
Original file line number Diff line number Diff line change
@@ -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' },
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import { WeatherForecast } from './setup'
const test: WeatherForecast = {
id: 123456,
station: 'Acropolis Weather Reporter',
rain: {}, // rejected
// @ts-expect-error
rain: {},
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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 },
}

This file was deleted.

4 changes: 4 additions & 0 deletions test/single-member-objects/has-key-not-of-T-nor-of-U.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { A_XOR_B } from './setup'

// @ts-expect-error
const test: A_XOR_B = { lel: '' }

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { A_XOR_B } from './setup'

// @ts-expect-error
const test: A_XOR_B = {a: '', lel: '' }

This file was deleted.

4 changes: 4 additions & 0 deletions test/single-member-objects/has-key-of-T-and-key-of-U.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { A_XOR_B } from './setup'

// @ts-expect-error
const test: A_XOR_B = { a: '', b: '' }
3 changes: 0 additions & 3 deletions test/single-member-objects/has-no-keys.fail.spec.ts

This file was deleted.

4 changes: 4 additions & 0 deletions test/single-member-objects/has-no-keys.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { A_XOR_B } from './setup'

// @ts-expect-error
const test: A_XOR_B = {}

0 comments on commit 197fbe3

Please sign in to comment.