Skip to content

Commit 4cef77b

Browse files
committed
Add generic and literal array form tests
1 parent 2e076a1 commit 4cef77b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/unit/array.spec.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
import * as util from "../util";
22

33
test("Array access", () => {
4+
const result = util.transpileAndExecute(
5+
`const arr: Array<number> = [3,5,1];
6+
return arr[1];`,
7+
);
8+
expect(result).toBe(5);
9+
});
10+
11+
test("ReadonlyArray access", () => {
12+
const result = util.transpileAndExecute(
13+
`const arr: ReadonlyArray<number> = [3,5,1];
14+
return arr[1];`,
15+
);
16+
expect(result).toBe(5);
17+
});
18+
19+
test("Array literal access", () => {
420
const result = util.transpileAndExecute(
521
`const arr: number[] = [3,5,1];
622
return arr[1];`,
723
);
824
expect(result).toBe(5);
925
});
1026

11-
test("Readonly Array access", () => {
27+
test("Readonly array literal access", () => {
1228
const result = util.transpileAndExecute(
1329
`const arr: readonly number[] = [3,5,1];
1430
return arr[1];`,

0 commit comments

Comments
 (0)