From ec3a9075f97f72192478330f2ee3fb1efe127826 Mon Sep 17 00:00:00 2001 From: Whiteknight Date: Mon, 7 Dec 2009 04:26:24 -0500 Subject: [PATCH] update all the test_script files to use TAP functions and add a new syntax test for script dispatching --- .gitignore | 1 + t/lib/test_script.m | 2 +- t/lib/test_script2.m | 9 ++------- t/lib/test_script3.m | 8 ++++---- t/syntax/scripts.t | 10 ++++++++++ 5 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 t/syntax/scripts.t diff --git a/.gitignore b/.gitignore index 84f83d6..fced798 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ src/gen_*.pir *.c *.o *.pbc +*~ diff --git a/t/lib/test_script.m b/t/lib/test_script.m index 95551aa..6d50d8b 100644 --- a/t/lib/test_script.m +++ b/t/lib/test_script.m @@ -1,3 +1,3 @@ % Test that a script file (without a function declaration) is executed directly -printf("ok 13\n"); +ok(1, "executed script"); diff --git a/t/lib/test_script2.m b/t/lib/test_script2.m index 2f211ac..f7e8f1c 100644 --- a/t/lib/test_script2.m +++ b/t/lib/test_script2.m @@ -1,9 +1,4 @@ -% A more complicated test script with if statements to prove that it still works -% as a script +% Second test that a script executes as expected. x = 1; -if x == 1 - printf("ok 14\n"); -else - printf("not ok 14\n"); -endif +is(x, 1, "this script works too") diff --git a/t/lib/test_script3.m b/t/lib/test_script3.m index 190e958..a172e29 100644 --- a/t/lib/test_script3.m +++ b/t/lib/test_script3.m @@ -1,8 +1,8 @@ -% Test that if there is a function declaration here, we call that instead of -% other stuff in the file +% Test that if there is a function declaration here of the same name, we +% call that instead of other stuff in the file -printf("not ok 15\n"); +ok(0, "executed other stuff") function test_script3() - printf("ok 15\n"); + ok(1, "executed correctly"); endfunction diff --git a/t/syntax/scripts.t b/t/syntax/scripts.t new file mode 100644 index 0000000..86bc43e --- /dev/null +++ b/t/syntax/scripts.t @@ -0,0 +1,10 @@ +plan(3); + +addpath("t/lib/"); + +% Show that we can find and execute a script file +test_script(); % Test 1 + +test_script2(); % Test 2 + +test_script3(); % Test 3