aboutsummaryrefslogtreecommitdiff
path: root/tests/file.test
blob: 86ddd9e1ac35a424949fffa8580480f6ee09459f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

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

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

touch empty
echo "#!/bin/bash" > bash.script
echo "#!  /bin/bash" > bash.script2
echo "#!  /usr/bin/env python" > env.python.script
echo "Hello, world!" > ascii
echo "cafebabe000000310000" | xxd -r -p > java.class

testing "file empty" "file empty" "empty: empty\n" "" ""
testing "file bash.script" "file bash.script" "bash.script: /bin/bash script\n" "" ""
testing "file bash.script with spaces" "file bash.script2" "bash.script2: /bin/bash script\n" "" ""
testing "file env python script" "file env.python.script" "env.python.script: python script\n" "" ""
testing "file ascii" "file ascii" "ascii: ASCII text\n" "" ""
testing "file java class" "file java.class" "java.class: Java class file, version 49.0\n" "" ""

rm empty bash.script bash.script2 env.python.script ascii java.class