diff options
Diffstat (limited to 'tests/scripts/functions/wildcard')
-rw-r--r-- | tests/scripts/functions/wildcard | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/tests/scripts/functions/wildcard b/tests/scripts/functions/wildcard new file mode 100644 index 0000000..d21747f --- /dev/null +++ b/tests/scripts/functions/wildcard @@ -0,0 +1,103 @@ +# -*-perl-*- + +$description = "The following test creates a makefile to test wildcard\n" + ."expansions and the ability to put a command on the same\n" + ."line as the target name separated by a semi-colon."; + +$details = "This test creates 4 files by the names of 1.example, \n" + ."two.example and 3.example. We execute three tests. The first\n" + ."executes the print1 target which tests the '*' wildcard by \n" + ."echoing all filenames by the name of '*.example'. The second\n" + ."test echo's all files which match '?.example' and \n" + ."[a-z0-9].example. Lastly we clean up all of the files using\n" + ."the '*' wildcard as in the first test"; + +if ($vos) +{ + $delete_command = "delete_file -no_ask"; +} +else +{ + $delete_command = "rm"; +} + + +open(MAKEFILE,"> $makefile"); + +# The Contents of the MAKEFILE ... + +print MAKEFILE <<EOM; +print1: ;\@echo \$(wildcard example.*) +print2: +\t\@echo \$(wildcard example.?) +\t\@echo \$(wildcard example.[a-z0-9]) +\t\@echo \$(wildcard example.[!A-Za-z_\\!]) +clean: +\t$delete_command \$(wildcard example.*) +EOM + +# END of Contents of MAKEFILE + +close(MAKEFILE); + +&touch("example.1"); +&touch("example.two"); +&touch("example.3"); +&touch("example.for"); +&touch("example._"); + +# TEST #1 +# ------- + +$answer = "example.1 example.3 example._ example.for example.two\n"; + +&run_make_with_options($makefile,"print1",&get_logfile); + +&compare_output($answer,&get_logfile(1)); + + +# TEST #2 +# ------- + +$answer = "example.1 example.3 example._\n" + ."example.1 example.3\n" + ."example.1 example.3\n"; + +&run_make_with_options($makefile,"print2",&get_logfile); + +&compare_output($answer,&get_logfile(1)); + + +# TEST #3 +# ------- + +$answer = "$delete_command example.1 example.3 example._ example.for example.two"; +if ($vos) +{ + $answer .= " \n"; +} +else +{ + $answer .= "\n"; +} + +&run_make_with_options($makefile,"clean",&get_logfile); + +&compare_output($answer,&get_logfile(1)); + +if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for")) +{ + $test_passed = 0; +} + + +1; + + + + + + + + + |