view scripts/test/cat.test @ 694:786841fdb1e0

Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring.
author Rob Landley <rob@landley.net>
date Tue, 13 Nov 2012 17:14:08 -0600
parents 7bdca139b03f
children cecd0fd45c49
line wrap: on
line source

#!/bin/bash

[ -f testing.sh ] && . testing.sh

#testing "name" "command" "result" "infile" "stdin"

testing "cat" "cat && echo yes" "oneyes\n" "" "one"
testing "cat file1" \
	"cat /proc/self/exe > file1 && diff -u /proc/self/exe file1 && echo yes" \
	"yes\n" "" ""
#testing "cat file1 file2" "cat /bin/cat file1 > file2 && diff -u -

testing "cat - file1" \
	"cat - file1 | diff -a -U 0 - file1 | tail -n 1" \
	"-hello\n" "" "hello\n"

rm file1
#testing "cat file1 file2" "cat $0"
#testing "cat - file"
#testing "cat > /dev/full"
#testing "cat file1 notfound file2"