Skip to content

Commit 370767b

Browse files
committedOct 20, 2013
Split unit tests.
Remove expr.c and add string.c and command.c.
1 parent e6e44fc commit 370767b

File tree

9 files changed

+45
-36
lines changed

9 files changed

+45
-36
lines changed
 

‎src/test.ml

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,22 @@ let test_cases = "Batsh Unit Tests" >::: [
5858
"[Bash]Arith" >:: test "arith" test_bash;
5959
"[Bash]Assignment" >:: test "assignment" test_bash;
6060
"[Bash]Array" >:: test "array" test_bash;
61-
"[Bash]Expressions" >:: test "expr" test_bash;
61+
"[Bash]String" >:: test "string" test_bash;
6262
"[Bash]If" >:: test "if" test_bash;
6363
"[Bash]While" >:: test "while" test_bash;
6464
"[Bash]Function" >:: test "function" test_bash;
6565
"[Bash]Recursion" >:: test "recursion" test_bash;
66+
"[Bash]Command" >:: test "command" test_bash;
6667
"[Winbat]Block" >:: test "block" test_winbat;
6768
"[Winbat]Arith" >:: test "arith" test_winbat;
6869
"[Winbat]Assignment" >:: test "assignment" test_winbat;
6970
(* "[Winbat]Array" >:: test "array" test_winbat; *)
70-
(* "[Winbat]Expressions" >:: test "expr" test_winbat; *)
71+
"[Winbat]String" >:: test "string" test_winbat;
7172
"[Winbat]If" >:: test "if" test_winbat;
7273
"[Winbat]While" >:: test "while" test_winbat;
7374
"[Winbat]Function" >:: test "function" test_winbat;
7475
"[Winbat]Recursion" >:: test "recursion" test_winbat;
76+
(* "[Winbat]Command" >:: test "command" test_winbat; *)
7577
]
7678

7779
let _ =

‎tests/array.c

+6
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ a[0] = 2 * 9;
33
a[2] = "abx";
44
a[5] = "5" ++ a[0];
55
println(a[0], a[1], a[2], a[3], a[4], a[5]);
6+
a = [1, 2, 3];
7+
println(a[0], a[1], a[2]);
8+
println(("10" ++ a[0]) * 2);
9+
println(len(a));
10+
println(len(a) * 8);
11+
//println([1, 2, 3]);

‎tests/command.c

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
call("println", "Println Called");
2+
cmd = "ec" ++ "ho";
3+
call(cmd, "Echo Called");
4+
println(expr(36, "+", 6));

‎tests/expr.c

-18
This file was deleted.

‎tests/output/array.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
18 y abx 1 518
2+
1 2 3
3+
202
4+
3
5+
24

‎tests/output/command.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Println Called
2+
Echo Called
3+
42

‎tests/output/expr.txt

-16
This file was deleted.

‎tests/output/string.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
BYVoid
2+
Slash/
3+
Backslash\
4+
Quote"'
5+
Tab Tab
6+
http://www.byvoid.com
7+
3BYVoid8
8+
6
9+
62
10+
35
11+
1

‎tests/string.c

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
println("BYVoid");
2+
println("Slash/");
3+
println("Backslash\\");
4+
println("Quote\"'");
5+
println("Tab\tTab");
6+
//println("Newline\nLine2");
7+
//println("!");
8+
println("http://" ++ "www." ++ ("byvoid" ++ ".com"));
9+
println(6 / 2 ++ "BYVoid" ++ 3 + 5);
10+
println(3 + "3");
11+
println(3 + "3" ++ "2");
12+
println(3 + ("3" ++ "2"));
13+
println("BYVoid" == "BYVoid");

0 commit comments

Comments
 (0)
Failed to load comments.