Skip to content

Commit e9679f0

Browse files
committed
Add tests
1 parent d069da2 commit e9679f0

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// @strict: true
2+
3+
declare function foo(a: number, b: string): string;
4+
5+
let f00 = foo.bind(undefined);
6+
let f01 = foo.bind(undefined, 10);
7+
let f02 = foo.bind(undefined, 10, "hello");
8+
let f03 = foo.bind(undefined, 10, 20); // Error
9+
10+
let c00 = foo.call(undefined, 10, "hello");
11+
let c01 = foo.call(undefined, 10); // Error
12+
let c02 = foo.call(undefined, 10, 20); // Error
13+
let c03 = foo.call(undefined, 10, "hello", 30); // Error
14+
15+
let a00 = foo.apply(undefined, [10, "hello"]);
16+
let a01 = foo.apply(undefined, [10]); // Error
17+
let a02 = foo.apply(undefined, [10, 20]); // Error
18+
let a03 = foo.apply(undefined, [10, "hello", 30]); // Error
19+
20+
class C {
21+
constructor(a: number, b: string) {}
22+
foo(this: this, a: number, b: string): string { return "" }
23+
}
24+
25+
declare let c: C;
26+
declare let obj: {};
27+
28+
let f10 = c.foo.bind(c);
29+
let f11 = c.foo.bind(c, 10);
30+
let f12 = c.foo.bind(c, 10, "hello");
31+
let f13 = c.foo.bind(c, 10, 20); // Error
32+
let f14 = c.foo.bind(undefined); // Error
33+
34+
let c10 = c.foo.call(c, 10, "hello");
35+
let c11 = c.foo.call(c, 10); // Error
36+
let c12 = c.foo.call(c, 10, 20); // Error
37+
let c13 = c.foo.call(c, 10, "hello", 30); // Error
38+
let c14 = c.foo.call(undefined, 10, "hello"); // Error
39+
40+
let a10 = c.foo.apply(c, [10, "hello"]);
41+
let a11 = c.foo.apply(c, [10]); // Error
42+
let a12 = c.foo.apply(c, [10, 20]); // Error
43+
let a13 = c.foo.apply(c, [10, "hello", 30]); // Error
44+
let a14 = c.foo.apply(undefined, [10, "hello"]); // Error
45+
46+
let f20 = C.bind(undefined);
47+
let f21 = C.bind(undefined, 10);
48+
let f22 = C.bind(undefined, 10, "hello");
49+
let f23 = C.bind(undefined, 10, 20); // Error
50+
51+
C.call(c, 10, "hello");
52+
C.call(c, 10); // Error
53+
C.call(c, 10, 20); // Error
54+
C.call(c, 10, "hello", 30); // Error
55+
56+
C.apply(c, [10, "hello"]);
57+
C.apply(c, [10]); // Error
58+
C.apply(c, [10, 20]); // Error
59+
C.apply(c, [10, "hello", 30]); // Error

0 commit comments

Comments
 (0)