Add tests for Bash
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
diff --git a/tests/languages/bash/comment_feature.test b/tests/languages/bash/comment_feature.test
new file mode 100644
index 0000000..5824909
--- /dev/null
+++ b/tests/languages/bash/comment_feature.test
@@ -0,0 +1,13 @@
+#foo
+# bar
+
+----------------------------------------------------
+
+[
+ ["comment", "#foo"],
+ ["comment", "# bar"]
+]
+
+----------------------------------------------------
+
+Checks for comments.
\ No newline at end of file
diff --git a/tests/languages/bash/function_feature.test b/tests/languages/bash/function_feature.test
new file mode 100644
index 0000000..cb0def2
--- /dev/null
+++ b/tests/languages/bash/function_feature.test
@@ -0,0 +1,101 @@
+alias apropos apt-get aptitude aspell
+awk basename bash bc bg
+builtin bzip2 cal cat cd
+cfdisk chgrp chmod chown chroot
+chkconfig cksum clear cmp comm
+command cp cron crontab csplit
+cut date dc dd ddrescue
+df diff diff3 dig dir dircolors
+dirname dirs dmesg du
+egrep eject enable env ethtool
+eval exec expand expect
+export expr fdformat fdisk
+fg fgrep file find fmt
+fold format free fsck ftp
+fuser gawk getopts git grep
+groupadd groupdel groupmod groups
+gzip hash head help hg history
+hostname htop iconv id ifconfig
+ifdown ifup import install jobs
+join kill killall less link ln
+locate logname logout look lpc lpr
+lprint lprintd lprintq lprm ls
+lsof make man mkdir mkfifo
+mkisofs mknod more most mount
+mtools mtr mv mmv nano netstat
+nice nl nohup notify-send nslookup
+open op passwd paste pathchk ping
+pkill popd pr printcap printenv
+printf ps pushd pv pwd quota
+quotacheck quotactl ram rar rcp
+read readarray readonly reboot
+rename renice remsync rev rm
+rmdir rsync screen scp sdiff sed
+seq service sftp shift
+shopt shutdown sleep slocate
+sort source split ssh stat strace
+su sudo sum suspend sync tail tar
+tee test time timeout times
+touch top traceroute trap tr
+tsort tty type ulimit umask
+umount unalias uname unexpand uniq
+units unrar unshar uptime
+useradd userdel usermod users uuencode
+uudecode v vdir vi vmstat wait watch
+wc wget whereis which who whoami write
+xargs xdg-open yes zip
+
+----------------------------------------------------
+
+[
+ ["function", "alias"], ["function", "apropos"], ["function", "apt-get"], ["function", "aptitude"], ["function", "aspell"],
+ ["function", "awk"], ["function", "basename"], ["function", "bash"], ["function", "bc"], ["function", "bg"],
+ ["function", "builtin"], ["function", "bzip2"], ["function", "cal"], ["function", "cat"], ["function", "cd"],
+ ["function", "cfdisk"], ["function", "chgrp"], ["function", "chmod"], ["function", "chown"], ["function", "chroot"],
+ ["function", "chkconfig"], ["function", "cksum"], ["function", "clear"], ["function", "cmp"], ["function", "comm"],
+ ["function", "command"], ["function", "cp"], ["function", "cron"], ["function", "crontab"], ["function", "csplit"],
+ ["function", "cut"], ["function", "date"], ["function", "dc"], ["function", "dd"], ["function", "ddrescue"],
+ ["function", "df"], ["function", "diff"], ["function", "diff3"], ["function", "dig"], ["function", "dir"], ["function", "dircolors"],
+ ["function", "dirname"], ["function", "dirs"], ["function", "dmesg"], ["function", "du"],
+ ["function", "egrep"], ["function", "eject"], ["function", "enable"], ["function", "env"], ["function", "ethtool"],
+ ["function", "eval"], ["function", "exec"], ["function", "expand"], ["function", "expect"],
+ ["function", "export"], ["function", "expr"], ["function", "fdformat"], ["function", "fdisk"],
+ ["function", "fg"], ["function", "fgrep"], ["function", "file"], ["function", "find"], ["function", "fmt"],
+ ["function", "fold"], ["function", "format"], ["function", "free"], ["function", "fsck"], ["function", "ftp"],
+ ["function", "fuser"], ["function", "gawk"], ["function", "getopts"], ["function", "git"], ["function", "grep"],
+ ["function", "groupadd"], ["function", "groupdel"], ["function", "groupmod"], ["function", "groups"],
+ ["function", "gzip"], ["function", "hash"], ["function", "head"], ["function", "help"], ["function", "hg"], ["function", "history"],
+ ["function", "hostname"], ["function", "htop"], ["function", "iconv"], ["function", "id"], ["function", "ifconfig"],
+ ["function", "ifdown"], ["function", "ifup"], ["function", "import"], ["function", "install"], ["function", "jobs"],
+ ["function", "join"], ["function", "kill"], ["function", "killall"], ["function", "less"], ["function", "link"], ["function", "ln"],
+ ["function", "locate"], ["function", "logname"], ["function", "logout"], ["function", "look"], ["function", "lpc"], ["function", "lpr"],
+ ["function", "lprint"], ["function", "lprintd"], ["function", "lprintq"], ["function", "lprm"], ["function", "ls"],
+ ["function", "lsof"], ["function", "make"], ["function", "man"], ["function", "mkdir"], ["function", "mkfifo"],
+ ["function", "mkisofs"], ["function", "mknod"], ["function", "more"], ["function", "most"], ["function", "mount"],
+ ["function", "mtools"], ["function", "mtr"], ["function", "mv"], ["function", "mmv"], ["function", "nano"], ["function", "netstat"],
+ ["function", "nice"], ["function", "nl"], ["function", "nohup"], ["function", "notify-send"], ["function", "nslookup"],
+ ["function", "open"], ["function", "op"], ["function", "passwd"], ["function", "paste"], ["function", "pathchk"], ["function", "ping"],
+ ["function", "pkill"], ["function", "popd"], ["function", "pr"], ["function", "printcap"], ["function", "printenv"],
+ ["function", "printf"], ["function", "ps"], ["function", "pushd"], ["function", "pv"], ["function", "pwd"], ["function", "quota"],
+ ["function", "quotacheck"], ["function", "quotactl"], ["function", "ram"], ["function", "rar"], ["function", "rcp"],
+ ["function", "read"], ["function", "readarray"], ["function", "readonly"], ["function", "reboot"],
+ ["function", "rename"], ["function", "renice"], ["function", "remsync"], ["function", "rev"], ["function", "rm"],
+ ["function", "rmdir"], ["function", "rsync"], ["function", "screen"], ["function", "scp"], ["function", "sdiff"], ["function", "sed"],
+ ["function", "seq"], ["function", "service"], ["function", "sftp"], ["function", "shift"],
+ ["function", "shopt"], ["function", "shutdown"], ["function", "sleep"], ["function", "slocate"],
+ ["function", "sort"], ["function", "source"], ["function", "split"], ["function", "ssh"], ["function", "stat"], ["function", "strace"],
+ ["function", "su"], ["function", "sudo"], ["function", "sum"], ["function", "suspend"], ["function", "sync"], ["function", "tail"], ["function", "tar"],
+ ["function", "tee"], ["function", "test"], ["function", "time"], ["function", "timeout"], ["function", "times"],
+ ["function", "touch"], ["function", "top"], ["function", "traceroute"], ["function", "trap"], ["function", "tr"],
+ ["function", "tsort"], ["function", "tty"], ["function", "type"], ["function", "ulimit"], ["function", "umask"],
+ ["function", "umount"], ["function", "unalias"], ["function", "uname"], ["function", "unexpand"], ["function", "uniq"],
+ ["function", "units"], ["function", "unrar"], ["function", "unshar"], ["function", "uptime"],
+ ["function", "useradd"], ["function", "userdel"], ["function", "usermod"], ["function", "users"], ["function", "uuencode"],
+ ["function", "uudecode"], ["function", "v"], ["function", "vdir"], ["function", "vi"], ["function", "vmstat"], ["function", "wait"], ["function", "watch"],
+ ["function", "wc"], ["function", "wget"], ["function", "whereis"], ["function", "which"], ["function", "who"], ["function", "whoami"], ["function", "write"],
+ ["function", "xargs"], ["function", "xdg-open"], ["function", "yes"], ["function", "zip"]
+]
+
+----------------------------------------------------
+
+Checks for all functions.
\ No newline at end of file
diff --git a/tests/languages/bash/important_feature.test b/tests/languages/bash/important_feature.test
new file mode 100644
index 0000000..0e03588
--- /dev/null
+++ b/tests/languages/bash/important_feature.test
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+----------------------------------------------------
+
+[
+ ["important", "#!/bin/bash"]
+]
+
+----------------------------------------------------
+
+Checks for shebang.
\ No newline at end of file
diff --git a/tests/languages/bash/keyword_feature.test b/tests/languages/bash/keyword_feature.test
new file mode 100644
index 0000000..ce35561
--- /dev/null
+++ b/tests/languages/bash/keyword_feature.test
@@ -0,0 +1,19 @@
+if then else elif fi
+for break continue while
+in case function select
+do done until echo exit
+return set declare
+
+----------------------------------------------------
+
+[
+ ["keyword", "if"], ["keyword", "then"], ["keyword", "else"], ["keyword", "elif"], ["keyword", "fi"],
+ ["keyword", "for"], ["keyword", "break"], ["keyword", "continue"], ["keyword", "while"],
+ ["keyword", "in"], ["keyword", "case"], ["keyword", "function"], ["keyword", "select"],
+ ["keyword", "do"], ["keyword", "done"], ["keyword", "until"], ["keyword", "echo"], ["keyword", "exit"],
+ ["keyword", "return"], ["keyword", "set"], ["keyword", "declare"]
+]
+
+----------------------------------------------------
+
+Checks for all keywords.
\ No newline at end of file
diff --git a/tests/languages/bash/string_feature.test b/tests/languages/bash/string_feature.test
new file mode 100644
index 0000000..2426bc7
--- /dev/null
+++ b/tests/languages/bash/string_feature.test
@@ -0,0 +1,32 @@
+""
+''
+"foo"
+'foo'
+"foo
+bar"
+'foo
+bar'
+"$@"
+"${foo}"
+
+----------------------------------------------------
+
+[
+ ["string", ["\"\""]],
+ ["string", ["''"]],
+ ["string", ["\"foo\""]],
+ ["string", ["'foo'"]],
+ ["string", ["\"foo\r\nbar\""]],
+ ["string", ["'foo\r\nbar'"]],
+ ["string", [
+ "\"", ["property", "$@"], "\""
+ ]],
+ ["string", [
+ "\"", ["property", "${foo}"], "\""
+ ]]
+]
+
+----------------------------------------------------
+
+Checks for single-quoted and double-quoted strings.
+Also checks for variables in strings.
\ No newline at end of file
diff --git a/tests/languages/bash/variable_feature.test b/tests/languages/bash/variable_feature.test
new file mode 100644
index 0000000..58cca25
--- /dev/null
+++ b/tests/languages/bash/variable_feature.test
@@ -0,0 +1,15 @@
+$foo
+$@
+${foo bar}
+
+----------------------------------------------------
+
+[
+ ["property", "$foo"],
+ ["property", "$@"],
+ ["property", "${foo bar}"]
+]
+
+----------------------------------------------------
+
+Checks for variables.
\ No newline at end of file