| 1 | metadata: |
| 2 | category: Untested |
| 3 | description: Tests converted from POSIX compliance suite |
| 4 | auto_generated: true |
| 5 | needs_review: Tests with MANUAL_REVIEW need expected output verification |
| 6 | tests: |
| 7 | - name: '131. COMMAND BUILTIN - PATH SEARCH: command -v ls' |
| 8 | steps: |
| 9 | - send_line: command -v ls >/dev/null && echo found |
| 10 | expect_output: found |
| 11 | match_type: contains |
| 12 | auto_fixed: shell_execution |
| 13 | - name: '131. COMMAND BUILTIN - PATH SEARCH: command -v nonexistent' |
| 14 | steps: |
| 15 | - send_line: command -v nonexistent >/dev/null || echo notfound |
| 16 | expect_output: notfound |
| 17 | match_type: contains |
| 18 | auto_fixed: shell_execution |
| 19 | - name: '131. COMMAND BUILTIN - PATH SEARCH: command without options' |
| 20 | steps: |
| 21 | - send_line: command echo test |
| 22 | expect_output: test |
| 23 | match_type: contains |
| 24 | auto_fixed: shell_execution |
| 25 | - name: '132. MULTI-FD REDIRECTIONS: fd 3 redirect write' |
| 26 | steps: |
| 27 | - send_line: exec 3>/tmp/posix_fd3.txt; echo test >&3; exec 3>&-; cat /tmp/posix_fd3.txt; |
| 28 | rm /tmp/posix_fd3.txt |
| 29 | expect_output: test |
| 30 | match_type: contains |
| 31 | auto_fixed: shell_execution |
| 32 | - name: '132. MULTI-FD REDIRECTIONS: fd 4 redirect read' |
| 33 | steps: |
| 34 | - send_line: echo data > /tmp/posix_fd4.txt; exec 4</tmp/posix_fd4.txt; read line |
| 35 | <&4; echo $line; exec 4<&-; rm /tmp/posix_fd4.txt |
| 36 | expect_output: data |
| 37 | match_type: contains |
| 38 | auto_fixed: shell_execution |
| 39 | - name: '132. MULTI-FD REDIRECTIONS: fd duplication' |
| 40 | steps: |
| 41 | - send_line: exec 5>&1; echo stdout >&5; exec 5>&- |
| 42 | expect_output: stdout |
| 43 | match_type: contains |
| 44 | auto_fixed: shell_execution |
| 45 | - name: '132. MULTI-FD REDIRECTIONS: fd 3 and 4 together' |
| 46 | steps: |
| 47 | - send_line: exec 3>/tmp/posix_3.txt 4>/tmp/posix_4.txt; echo a >&3; echo b >&4; |
| 48 | exec 3>&- 4>&-; cat /tmp/posix_3.txt /tmp/posix_4.txt; rm /tmp/posix_3.txt /tmp/posix_4.txt |
| 49 | expect_output: 'a' |
| 50 | match_type: contains |
| 51 | - name: '133. EXEC WITH SHELL REDIRECTIONS: exec redirect stdout' |
| 52 | steps: |
| 53 | - send_line: exec 3>&1; exec >/tmp/posix_exec_out.txt; echo redirected; exec >&3; |
| 54 | cat /tmp/posix_exec_out.txt; rm /tmp/posix_exec_out.txt |
| 55 | expect_output: redirected |
| 56 | match_type: contains |
| 57 | auto_fixed: shell_execution |
| 58 | - name: '133. EXEC WITH SHELL REDIRECTIONS: exec redirect stdin' |
| 59 | steps: |
| 60 | - send_line: echo testdata > /tmp/posix_exec_in.txt; exec </tmp/posix_exec_in.txt; |
| 61 | read data; echo $data; rm /tmp/posix_exec_in.txt |
| 62 | expect_output: testdata |
| 63 | match_type: contains |
| 64 | auto_fixed: shell_execution |
| 65 | - name: '134. SET OPTION INTERACTIONS: set -e with true' |
| 66 | steps: |
| 67 | - send_line: set -e; true; echo ok |
| 68 | expect_output: ok |
| 69 | match_type: contains |
| 70 | - name: '134. SET OPTION INTERACTIONS: set -u with unset var' |
| 71 | steps: |
| 72 | - send_line: set -u; echo ${UNSET_VAR:-default} |
| 73 | expect_output: default |
| 74 | match_type: contains |
| 75 | auto_fixed: shell_execution |
| 76 | - name: '134. SET OPTION INTERACTIONS: set -C noclobber' |
| 77 | steps: |
| 78 | - send_line: set -C; echo test > /tmp/posix_clobber.txt; echo ok; rm /tmp/posix_clobber.txt |
| 79 | expect_output: ok |
| 80 | match_type: contains |
| 81 | auto_fixed: shell_execution |
| 82 | - name: '134. SET OPTION INTERACTIONS: set -C override with >|' |
| 83 | steps: |
| 84 | - send_line: set -C; echo test > /tmp/posix_clobber2.txt; echo override >| /tmp/posix_clobber2.txt; |
| 85 | cat /tmp/posix_clobber2.txt; rm /tmp/posix_clobber2.txt |
| 86 | expect_output: override |
| 87 | match_type: contains |
| 88 | auto_fixed: shell_execution |
| 89 | - name: '135. SPECIAL BUILTIN ERROR HANDLING: readonly error exits' |
| 90 | steps: |
| 91 | - send_line: (readonly VAR=1; VAR=2 2>/dev/null; echo should not print) || echo |
| 92 | exited |
| 93 | expect_output: exited |
| 94 | match_type: contains |
| 95 | - name: '135. SPECIAL BUILTIN ERROR HANDLING: export invalid' |
| 96 | steps: |
| 97 | - send_line: (export 123INVALID=value 2>/dev/null; echo should not print) || echo |
| 98 | exited |
| 99 | expect_output: should not print |
| 100 | match_type: contains |
| 101 | - name: '135. SPECIAL BUILTIN ERROR HANDLING: set invalid option' |
| 102 | steps: |
| 103 | - send_line: (set -@ 2>/dev/null; echo should not print) || echo exited |
| 104 | expect_output: exited |
| 105 | match_type: contains |
| 106 | - name: '137. NESTED PARAMETER EXPANSION: nested default' |
| 107 | steps: |
| 108 | - send_line: unset A B; echo ${A:-${B:-default}} |
| 109 | expect_output: default |
| 110 | match_type: contains |
| 111 | auto_fixed: shell_execution |
| 112 | - name: '137. NESTED PARAMETER EXPANSION: nested with set var' |
| 113 | steps: |
| 114 | - send_line: A=inner; unset B; echo ${B:-${A}} |
| 115 | expect_output: inner |
| 116 | match_type: contains |
| 117 | auto_fixed: shell_execution |
| 118 | - name: '137. NESTED PARAMETER EXPANSION: double nested' |
| 119 | steps: |
| 120 | - send_line: unset A B C; echo ${A:-${B:-${C:-triple}}} |
| 121 | expect_output: triple |
| 122 | match_type: contains |
| 123 | auto_fixed: shell_execution |
| 124 | - name: '138. PARAMETER LENGTH EDGE CASES: length of $@' |
| 125 | steps: |
| 126 | - send_line: set -- a b c; echo ${#@} |
| 127 | expect_output: '3' |
| 128 | match_type: contains |
| 129 | auto_fixed: shell_execution |
| 130 | - name: '138. PARAMETER LENGTH EDGE CASES: length of $*' |
| 131 | steps: |
| 132 | - send_line: set -- a b c; echo ${#*} |
| 133 | expect_output: '3' |
| 134 | match_type: contains |
| 135 | auto_fixed: shell_execution |
| 136 | - name: '138. PARAMETER LENGTH EDGE CASES: length of empty' |
| 137 | steps: |
| 138 | - send_line: VAR=; echo ${#VAR} |
| 139 | expect_output: '0' |
| 140 | match_type: contains |
| 141 | auto_fixed: shell_execution |
| 142 | - name: '138. PARAMETER LENGTH EDGE CASES: length of unset' |
| 143 | steps: |
| 144 | - send_line: unset VAR; echo ${#VAR} |
| 145 | expect_output: '0' |
| 146 | match_type: contains |
| 147 | auto_fixed: shell_execution |
| 148 | - name: '139. QUOTING EDGE CASES: empty double quotes' |
| 149 | steps: |
| 150 | - send_line: VAR=""; echo x${VAR}y |
| 151 | expect_output: xy |
| 152 | match_type: contains |
| 153 | auto_fixed: shell_execution |
| 154 | - name: '139. QUOTING EDGE CASES: empty single quotes' |
| 155 | steps: |
| 156 | - send_line: VAR=''; echo x${VAR}y |
| 157 | expect_output: xy |
| 158 | match_type: contains |
| 159 | - name: '139. QUOTING EDGE CASES: adjacent quotes concat' |
| 160 | steps: |
| 161 | - send_line: echo "a"b"c" |
| 162 | expect_output: a"b"c |
| 163 | match_type: contains |
| 164 | - name: '139. QUOTING EDGE CASES: quote in quote' |
| 165 | steps: |
| 166 | - send_line: echo "it |
| 167 | expect_output: it |
| 168 | match_type: contains |
| 169 | - name: '142. REDIRECTION EDGE CASES: close stdin' |
| 170 | steps: |
| 171 | - send_line: cat <&- 2>&1 | head -1 || echo ok |
| 172 | expect_output: ok |
| 173 | match_type: contains |
| 174 | - name: '142. REDIRECTION EDGE CASES: close stdout' |
| 175 | steps: |
| 176 | - send_line: echo test >&- 2>&1 |
| 177 | expect_output: test >&- 2>&1 |
| 178 | match_type: contains |
| 179 | - name: '142. REDIRECTION EDGE CASES: read/write mode' |
| 180 | steps: |
| 181 | - send_line: echo data > /tmp/posix_rw.txt; cat <> /tmp/posix_rw.txt; rm /tmp/posix_rw.txt |
| 182 | expect_output: data > /tmp/posix_rw.txt; cat <> /tmp/posix_rw.txt; rm /tmp/posix_rw.txt |
| 183 | match_type: contains |
| 184 | - name: '144. SET -n (NOEXEC) TESTING: set -n parse only' |
| 185 | steps: |
| 186 | - send_line: set -n; echo "should not execute"; false |
| 187 | expect_output: '' |
| 188 | match_type: contains |
| 189 | auto_fixed: manual_determination |
| 190 | - name: '145. SET -m (MONITOR) TESTING: set -m doesn''t affect output' |
| 191 | steps: |
| 192 | - send_line: set -m; echo test; set +m |
| 193 | expect_output: test |
| 194 | match_type: contains |
| 195 | auto_fixed: shell_execution |
| 196 |