• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3[ -f testing.sh ] && . testing.sh
4
5#testing "name" "command" "result" "infile" "stdin"
6
7touch empty
8echo "#!/bin/bash" > bash.script
9echo "#!  /bin/bash" > bash.script2
10echo "#!  /usr/bin/env python" > env.python.script
11echo "Hello, world!" > ascii
12echo "cafebabe000000310000" | xxd -r -p > java.class
13echo "6465780a3033350038ca8f6ce910f94e" | xxd -r -p > android.dex
14ln -s java.class symlink
15
16testing "empty" "file empty" "empty: empty\n" "" ""
17testing "bash.script" "file bash.script" "bash.script: /bin/bash script\n" "" ""
18testing "bash.script with spaces" "file bash.script2" "bash.script2: /bin/bash script\n" "" ""
19testing "env python script" "file env.python.script" "env.python.script: python script\n" "" ""
20testing "ascii" "file ascii" "ascii: ASCII text\n" "" ""
21testing "java class" "file java.class" "java.class: Java class file, version 49.0 (Java 1.5)\n" "" ""
22testing "Android .dex" "file android.dex" "android.dex: Android dex file, version 035\n" "" ""
23testing "symlink" "file symlink" "symlink: symbolic link\n" "" ""
24testing "symlink -h" "file -h symlink" "symlink: symbolic link\n" "" ""
25testing "symlink -L" "file -L symlink" "symlink: Java class file, version 49.0 (Java 1.5)\n" "" ""
26
27testing "- pipe" "cat java.class | file -" "-: Java class file, version 49.0 (Java 1.5)\n" "" ""
28testing "- redirect" "file - <java.class" "-: Java class file, version 49.0 (Java 1.5)\n" "" ""
29
30testing "/dev/zero" "file /dev/zero" "/dev/zero: character special\n" "" ""
31testing "- </dev/zero" "file - </dev/zero" "-: data\n" "" ""
32
33rm empty bash.script bash.script2 env.python.script ascii java.class android.dex
34