Skip to content

Commit

Permalink
added test cases for annotations, #53
Browse files Browse the repository at this point in the history
  • Loading branch information
bahuljain committed May 1, 2016
1 parent e41958c commit 5e58e81
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 6 deletions.
1 change: 1 addition & 0 deletions test/compiler-tests/fail-duplicate_args.jsjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
val y = /\(x, x) => x;
1 change: 1 addition & 0 deletions test/compiler-tests/fail-duplicate_args.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: 'x' cannot be redefined in the current scope
36 changes: 31 additions & 5 deletions test/compiler-tests/pass-assign2.jsjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
val x : num = 10;
val y : bool = true;
val s : string = "hello";
val a = 5;

val z : num = x + 10;
print(z);
val b = "hello world" ^ "!";

val c? = true && !false;

val d = (-);

val fun = /\(x, y) => {
x % y == 0;
};

val xs1 = ["1","2","3","4","5","6","7"];

val xs2 = [[1,2,3],[4,5,6],[7,8,9],[10]];

val map1 = {
1: "One",
2: "Two",
3: "Three"
};

val map2 = {
1: {
1: "One One",
2: "One Two"
},
2: {
1: "Two One",
2: "Two Two"
}
};
1 change: 0 additions & 1 deletion test/compiler-tests/pass-assign2.out
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
20
8 changes: 8 additions & 0 deletions test/compiler-tests/pass-generic_annotated_function.jsjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
val fun: (A, B) -> C = /\(x, y) => {
x % y == 0;
};

val fun2: A = /\(x, y) => {
x % y == 0;
};

Empty file.
4 changes: 4 additions & 0 deletions test/compiler-tests/pass-generic_annotated_list.jsjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
val xs2: list list A = [[1,2,3],[4,5,6],[7,8,9],[10]];

val xs1: A = [[1,2,3],[4,5,6],[7,8,9],[10]];

Empty file.
21 changes: 21 additions & 0 deletions test/compiler-tests/pass-generic_annotated_map.jsjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
val map1: A = {
1: {
1: "One One",
2: "One Two"
},
2: {
1: "Two One",
2: "Two Two"
}
};

val map2: <A: B> = {
1: {
1: "One One",
2: "One Two"
},
2: {
1: "Two One",
2: "Two Two"
}
};
Empty file.
3 changes: 3 additions & 0 deletions test/compiler-tests/pass-semi_annotated_function.jsjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
val fun: (num, A) -> B = /\(x:num, y): bool => {
x % y == 0;
};
Empty file.
10 changes: 10 additions & 0 deletions test/compiler-tests/pass-semi_annotated_map.jsjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
val map2: <num: A> = {
1: {
1: "One One",
2: "One Two"
},
2: {
1: "Two One",
2: "Two Two"
}
};
Empty file.

0 comments on commit 5e58e81

Please sign in to comment.