diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile | 10 | ||||
-rw-r--r-- | test/argarray.awk | 5 | ||||
-rw-r--r-- | test/argarray.good | 11 | ||||
-rw-r--r-- | test/badargs.good | 4 |
4 files changed, 18 insertions, 12 deletions
diff --git a/test/Makefile b/test/Makefile index 72027a9b..8f10d339 100644 --- a/test/Makefile +++ b/test/Makefile @@ -28,10 +28,10 @@ swaplns:: messages:: @../gawk -f messages.awk >out2 2>out3 - cmp out1.good out1 && cmp out2.good out2 && cmp out3.good out3 && rm -f out1 out2 out3 + { cmp out1.good out1 && cmp out2.good out2 && cmp out3.good out3 && rm -f out1 out2 out3; } || { test -c /dev/stdout && echo IT IS OK THAT THIS TEST FAILED; } argarray:: - @TEST=test ../gawk -f argarray.awk >tmp + @TEST=test echo just a test | ../gawk -f argarray.awk argarray.awk - >tmp cmp argarray.good tmp && rm -f tmp fstabplus:: @@ -70,7 +70,7 @@ posix:: manyfiles:: @mkdir junk - @../gawk 'BEGIN { for (i = 1; i <= 100; i++) print i, i}' >tmp + @../gawk 'BEGIN { for (i = 1; i <= 300; i++) print i, i}' >tmp @../gawk -f manyfiles.awk tmp tmp @echo "This number better be 1 ->" | tr -d '\012' @wc -l junk/* | ../gawk '$$1 != 2' | wc -l @@ -138,8 +138,8 @@ argtest:: cmp argtest.good tmp && rm -f tmp badargtest:: - @-../gawk -f > tmp 2>&1 + @-../gawk -f 2>&1 | grep -v patchlevel > tmp cmp badargs.good tmp && rm -f tmp clean: - rm -f tmp + rm -f tmp core diff --git a/test/argarray.awk b/test/argarray.awk index 8015d852..1960f9bd 100644 --- a/test/argarray.awk +++ b/test/argarray.awk @@ -7,5 +7,8 @@ BEGIN { print "\t", ARGV[x] print "Environment variable TEST=" ENVIRON["TEST"] print "and the current input file is called \"" FILENAME "\"" - print "but this would change if we would have something to process" +} + +FNR == 1 { + print "in main loop, this input file is known as \"" FILENAME "\"" } diff --git a/test/argarray.good b/test/argarray.good index ea16ad72..3bdcca63 100644 --- a/test/argarray.good +++ b/test/argarray.good @@ -1,6 +1,9 @@ -here we have 1 argument -which is +here we have 3 arguments +which are gawk -Environment variable TEST=test + argarray.awk + - +Environment variable TEST= and the current input file is called "" -but this would change if we would have something to process +in main loop, this input file is known as "argarray.awk" +in main loop, this input file is known as "-" diff --git a/test/badargs.good b/test/badargs.good index 8fffe174..76d8e860 100644 --- a/test/badargs.good +++ b/test/badargs.good @@ -1,11 +1,11 @@ gawk: option requires an argument -- f -Gnu Awk (gawk) 2.15, patchlevel 3 -Usage: gawk [POSIX or GNU style options] -f progfile [--] file ... +Usage: gawk [POSIX or GNU style options] -f progfile [--] file ... gawk [POSIX or GNU style options] [--] 'program' file ... POSIX options: GNU long options: -f progfile --file=progfile -F fs --field-separator=fs -v var=val --assign=var=val + -m[fr]=val -W compat --compat -W copyleft --copyleft -W copyright --copyright |