Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko committed Nov 16, 2019
1 parent 1d36a3f commit 40063fe
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/baselines/reference/arrayConcat2.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ a.concat('Hello');

var b = new Array<string>();
b.concat('hello');

// #26378

[1].concat(['']);

// #26976

[].concat([1]);


//// [arrayConcat2.js]
Expand All @@ -14,3 +22,7 @@ a.concat("hello", 'world');
a.concat('Hello');
var b = new Array();
b.concat('hello');
// #26378
[1].concat(['']);
// #26976
[].concat([1]);
12 changes: 12 additions & 0 deletions tests/baselines/reference/arrayConcat2.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,15 @@ b.concat('hello');
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

// #26378

[1].concat(['']);
>[1].concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

// #26976

[].concat([1]);
>[].concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

23 changes: 22 additions & 1 deletion tests/baselines/reference/arrayConcat2.types
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== tests/cases/compiler/arrayConcat2.ts ===
var a: string[] = [];
>a : string[]
>[] : undefined[]
>[] : never[]

a.concat("hello", 'world');
>a.concat("hello", 'world') : string[]
Expand Down Expand Up @@ -30,3 +30,24 @@ b.concat('hello');
>concat : { (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
>'hello' : "hello"

// #26378

[1].concat(['']);
>[1].concat(['']) : (string | number)[]
>[1].concat : { (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
>[1] : number[]
>1 : 1
>concat : { (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
>[''] : string[]
>'' : ""

// #26976

[].concat([1]);
>[].concat([1]) : number[]
>[].concat : { (...items: ConcatArray<never>[]): never[]; <U>(...items: (U | ConcatArray<U>)[]): U[]; }
>[] : never[]
>concat : { (...items: ConcatArray<never>[]): never[]; <U>(...items: (U | ConcatArray<U>)[]): U[]; }
>[1] : number[]
>1 : 1

9 changes: 9 additions & 0 deletions tests/cases/compiler/arrayConcat2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ a.concat('Hello');

var b = new Array<string>();
b.concat('hello');

// #26378

[1].concat(['']);

// #26976

// @strictNullChecks: true
[].concat([1]);

0 comments on commit 40063fe

Please sign in to comment.