Skip to content

Commit

Permalink
update all the test_script files to use TAP functions and add a new s…
Browse files Browse the repository at this point in the history
…yntax test for script dispatching
  • Loading branch information
Whiteknight committed Dec 7, 2009
1 parent 1f866c4 commit ec3a907
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@ src/gen_*.pir
*.c
*.o
*.pbc
*~
2 changes: 1 addition & 1 deletion 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");

9 changes: 2 additions & 7 deletions 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")
8 changes: 4 additions & 4 deletions 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
10 changes: 10 additions & 0 deletions 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

0 comments on commit ec3a907

Please sign in to comment.