Skip to content

Commit bc90e11

Browse files
move errs to their own test
1 parent d333f30 commit bc90e11

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

tests/compiler/call-rest-err-json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"asc_flags": [
3+
],
4+
"stderr": [
5+
"TS2322: Type '~lib/string/String' is not assignable to type 'i32'."
6+
]
7+
}

tests/compiler/call-rest-err.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function sum(...args: i32[]): i32 {
2+
let sum = 0;
3+
for (let i = 0, k = args.length; i < k; ++i) {
4+
sum += args[i];
5+
}
6+
return sum;
7+
}
8+
9+
function count<T>(...args: T[]): i32 {
10+
return args.length;
11+
}
12+
13+
sum("a", "b"); // expect a type mismatch error on each argument
14+
count(1, "a"); // expect a type mismatch error on the second argument

tests/compiler/call-rest.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"asc_flags": [
3-
],
4-
"stderr": [
5-
"TS2322: Type '~lib/string/String' is not assignable to type 'i32'."
63
]
74
}

tests/compiler/call-rest.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,3 @@ assert(count<i32>(1, 2, 3) == 3);
5252

5353
// inferred generic test
5454
assert(count('a','b','c') == 3);
55-
56-
// error cases
57-
count<i32>("a", "b"); // expect a type mismatch error on each argument
58-
count(1, "a"); // expect a type mismatch error on the second argument

0 commit comments

Comments
 (0)