diff options
Diffstat (limited to 'test/iolint.awk')
-rw-r--r-- | test/iolint.awk | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/test/iolint.awk b/test/iolint.awk new file mode 100644 index 00000000..e7408151 --- /dev/null +++ b/test/iolint.awk @@ -0,0 +1,71 @@ +BEGIN { + LINT = 1 + + # `%.*s' used for input file and for output file + print "hi" > "f1" + fflush("f1") + getline x < "f1" + print close("f1") + print close("f1") + fflush() + + # `%.*s' used for input file and input pipe + # `%.*s' used for input file and two-way pipe + # `%.*s' used for input pipe and two-way pipe + getline data3 < "echo hello" + "echo hello" |& getline data2 + "echo hello" | getline data + + print data, data2, data3 + + print close("echo hello") + print close("echo hello") + print close("echo hello") + fflush() + + # `%.*s' used for input file and output pipe + getline x < "cat" + print "foo" | "cat" + print close("cat") + print close("cat") + fflush() + + # unnecessary mixing of `>' and `>>' for file `%.*s' + print "foo" > "f2" + print "bar" >> "f2" + print close("f2") + print close("f2") # -1 expected here + fflush() + + # `%.*s' used for output file and output pipe" + print "junk" > "md5sum" + print "hello" | "md5sum" + print close("md5sum") + print close("md5sum") + fflush() + + # `%.*s' used for input pipe and output file + "echo hello" | getline junk + print "hello" > "echo hello" + print close("echo hello") + print close("echo hello") + fflush() + + # `%.*s' used for output file and output pipe + # `%.*s' used for output file and two-way pipe + # `%.*s' used for output pipe and two-way pipe + print "hello" > "cat" + print "hello" | "cat" + print "hello" |& "cat" + print close("cat") + print close("cat") + print close("cat") + fflush() + + # `%.*s' used for input pipe and output pipe + "echo hello" | getline junk + print "hello" | "echo hello" + print close("echo hello") + print close("echo hello") + fflush() +} |