| 1 | metadata: |
| 2 | category: Coverage |
| 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: '200. ARITHMETIC - OCTAL AND HEX LITERALS: octal literal' |
| 8 | steps: |
| 9 | - send_line: echo $((010)) |
| 10 | expect_output: '8' |
| 11 | match_type: contains |
| 12 | auto_fixed: shell_execution |
| 13 | - name: '200. ARITHMETIC - OCTAL AND HEX LITERALS: hex literal lowercase' |
| 14 | steps: |
| 15 | - send_line: echo $((0xff)) |
| 16 | expect_output: '255' |
| 17 | match_type: contains |
| 18 | auto_fixed: shell_execution |
| 19 | - name: '200. ARITHMETIC - OCTAL AND HEX LITERALS: hex literal uppercase' |
| 20 | steps: |
| 21 | - send_line: echo $((0xFF)) |
| 22 | expect_output: '255' |
| 23 | match_type: contains |
| 24 | auto_fixed: shell_execution |
| 25 | - name: '200. ARITHMETIC - OCTAL AND HEX LITERALS: octal in expression' |
| 26 | steps: |
| 27 | - send_line: echo $((010 + 1)) |
| 28 | expect_output: '9' |
| 29 | match_type: contains |
| 30 | auto_fixed: shell_execution |
| 31 | - name: '200. ARITHMETIC - OCTAL AND HEX LITERALS: hex in expression' |
| 32 | steps: |
| 33 | - send_line: echo $((0x10 + 1)) |
| 34 | expect_output: '17' |
| 35 | match_type: contains |
| 36 | auto_fixed: shell_execution |
| 37 | - name: '200. ARITHMETIC - OCTAL AND HEX LITERALS: mixed bases' |
| 38 | steps: |
| 39 | - send_line: echo $((0x10 + 010 + 10)) |
| 40 | expect_output: '34' |
| 41 | match_type: contains |
| 42 | auto_fixed: shell_execution |
| 43 | - name: '201. ARITHMETIC - NEGATIVE NUMBERS: negative literal' |
| 44 | steps: |
| 45 | - send_line: echo $((-5)) |
| 46 | expect_output: '-5' |
| 47 | match_type: contains |
| 48 | auto_fixed: shell_execution |
| 49 | - name: '201. ARITHMETIC - NEGATIVE NUMBERS: negative in addition' |
| 50 | steps: |
| 51 | - send_line: echo $((10 + -3)) |
| 52 | expect_output: '7' |
| 53 | match_type: contains |
| 54 | auto_fixed: shell_execution |
| 55 | - name: '201. ARITHMETIC - NEGATIVE NUMBERS: negative in subtraction' |
| 56 | steps: |
| 57 | - send_line: echo $((5 - -3)) |
| 58 | expect_output: '8' |
| 59 | match_type: contains |
| 60 | auto_fixed: shell_execution |
| 61 | - name: '201. ARITHMETIC - NEGATIVE NUMBERS: double negative' |
| 62 | steps: |
| 63 | - send_line: echo $((--5)) |
| 64 | expect_output: '5' |
| 65 | match_type: contains |
| 66 | auto_fixed: shell_execution |
| 67 | - name: '201. ARITHMETIC - NEGATIVE NUMBERS: negative multiplication' |
| 68 | steps: |
| 69 | - send_line: echo $((-3 * -4)) |
| 70 | expect_output: '12' |
| 71 | match_type: contains |
| 72 | auto_fixed: shell_execution |
| 73 | - name: '201. ARITHMETIC - NEGATIVE NUMBERS: negative division' |
| 74 | steps: |
| 75 | - send_line: echo $((-10 / 3)) |
| 76 | expect_output: '-3' |
| 77 | match_type: contains |
| 78 | auto_fixed: shell_execution |
| 79 | - name: '201. ARITHMETIC - NEGATIVE NUMBERS: negative modulo' |
| 80 | steps: |
| 81 | - send_line: echo $((-10 % 3)) |
| 82 | expect_output: '-1' |
| 83 | match_type: contains |
| 84 | auto_fixed: shell_execution |
| 85 | - name: '202. ARITHMETIC - NESTED EXPRESSIONS: nested arithmetic' |
| 86 | steps: |
| 87 | - send_line: echo $((1 + $((2 + 3)))) |
| 88 | expect_output: '6' |
| 89 | match_type: contains |
| 90 | auto_fixed: shell_execution |
| 91 | - name: '202. ARITHMETIC - NESTED EXPRESSIONS: deeply nested' |
| 92 | steps: |
| 93 | - send_line: echo $((1 + $((2 + $((3 + 4)))))) |
| 94 | expect_output: '10' |
| 95 | match_type: contains |
| 96 | auto_fixed: shell_execution |
| 97 | - name: '202. ARITHMETIC - NESTED EXPRESSIONS: nested with vars' |
| 98 | steps: |
| 99 | - send_line: a=5; echo $((a + $((a * 2)))) |
| 100 | expect_output: '15' |
| 101 | match_type: contains |
| 102 | auto_fixed: shell_execution |
| 103 | - name: '203. ARITHMETIC - COMMA OPERATOR: comma operator' |
| 104 | steps: |
| 105 | - send_line: echo $((1, 2, 3)) |
| 106 | expect_output: '3' |
| 107 | match_type: contains |
| 108 | auto_fixed: shell_execution |
| 109 | - name: '203. ARITHMETIC - COMMA OPERATOR: comma with assignment' |
| 110 | steps: |
| 111 | - send_line: echo $((a=1, b=2, a+b)) |
| 112 | expect_output: '3' |
| 113 | match_type: contains |
| 114 | auto_fixed: shell_execution |
| 115 | - name: '203. ARITHMETIC - COMMA OPERATOR: comma side effects' |
| 116 | steps: |
| 117 | - send_line: a=0; echo $((a=1, a=a+1, a)) |
| 118 | expect_output: '2' |
| 119 | match_type: contains |
| 120 | auto_fixed: shell_execution |
| 121 | - name: '210. WORD SPLITTING - EMPTY IFS: empty IFS no split' |
| 122 | steps: |
| 123 | - send_line: IFS=""; var="a b c"; set -- $var; echo $# |
| 124 | expect_output: '1' |
| 125 | match_type: contains |
| 126 | auto_fixed: shell_execution |
| 127 | - name: '210. WORD SPLITTING - EMPTY IFS: empty IFS preserves spaces' |
| 128 | steps: |
| 129 | - send_line: IFS=""; var="a b"; set -- $var; echo "$1" |
| 130 | expect_output: a b |
| 131 | match_type: contains |
| 132 | auto_fixed: shell_execution |
| 133 | - name: '211. WORD SPLITTING - IFS VARIATIONS: IFS whitespace only' |
| 134 | steps: |
| 135 | - send_line: IFS=" "; var="a b"; set -- $var; echo $# |
| 136 | expect_output: '2' |
| 137 | match_type: contains |
| 138 | auto_fixed: shell_execution |
| 139 | - name: '211. WORD SPLITTING - IFS VARIATIONS: IFS non-whitespace' |
| 140 | steps: |
| 141 | - send_line: IFS=":"; var="a:b:c"; set -- $var; echo $# |
| 142 | expect_output: '3' |
| 143 | match_type: contains |
| 144 | auto_fixed: shell_execution |
| 145 | - name: '211. WORD SPLITTING - IFS VARIATIONS: IFS mixed' |
| 146 | steps: |
| 147 | - send_line: 'IFS=" :"; var="a : b"; set -- $var; echo $#' |
| 148 | expect_output: '2' |
| 149 | match_type: contains |
| 150 | auto_fixed: shell_execution |
| 151 | - name: '211. WORD SPLITTING - IFS VARIATIONS: IFS tab' |
| 152 | steps: |
| 153 | - send_line: "IFS=$(printf '\\t'); var=$(printf 'a\\tb\\tc'); set -- $var; echo $#" |
| 154 | expect_output: '3' |
| 155 | match_type: contains |
| 156 | auto_fixed: shell_execution |
| 157 | - name: '212. WORD SPLITTING - $@ VS $*: $* unquoted' |
| 158 | steps: |
| 159 | - send_line: set -- "a b" "c d"; for x in $*; do echo "[$x]"; done |
| 160 | expect_output: '[a]' |
| 161 | match_type: contains |
| 162 | auto_fixed: shell_execution |
| 163 | - name: '212. WORD SPLITTING - $@ VS $*: $@ unquoted' |
| 164 | steps: |
| 165 | - send_line: set -- "a b" "c d"; for x in $@; do echo "[$x]"; done |
| 166 | expect_output: '[a]' |
| 167 | match_type: contains |
| 168 | auto_fixed: shell_execution |
| 169 | - name: '212. WORD SPLITTING - $@ VS $*: $* quoted' |
| 170 | steps: |
| 171 | - send_line: set -- "a b" "c d"; for x in "$*"; do echo "[$x]"; done |
| 172 | expect_output: '[a b c d]' |
| 173 | match_type: contains |
| 174 | auto_fixed: shell_execution |
| 175 | - name: '212. WORD SPLITTING - $@ VS $*: $@ quoted' |
| 176 | steps: |
| 177 | - send_line: set -- "a b" "c d"; for x in "$@"; do echo "[$x]"; done |
| 178 | expect_output: '[a b]' |
| 179 | match_type: contains |
| 180 | auto_fixed: shell_execution |
| 181 | - name: '212. WORD SPLITTING - $@ VS $*: $* with IFS' |
| 182 | steps: |
| 183 | - send_line: IFS=:; set -- a b c; echo "$*" |
| 184 | expect_output: a:b:c |
| 185 | match_type: contains |
| 186 | auto_fixed: shell_execution |
| 187 | - name: '212. WORD SPLITTING - $@ VS $*: $@ with IFS' |
| 188 | steps: |
| 189 | - send_line: IFS=:; set -- a b c; echo "$@" |
| 190 | expect_output: a b c |
| 191 | match_type: contains |
| 192 | auto_fixed: shell_execution |
| 193 | - name: '220. PARAMETER EXPANSION - EMPTY VS UNSET: :+ empty var' |
| 194 | steps: |
| 195 | - send_line: var=""; echo "${var:+set}" |
| 196 | expect_output: '' |
| 197 | match_type: exact |
| 198 | - name: '220. PARAMETER EXPANSION - EMPTY VS UNSET: :+ unset var' |
| 199 | steps: |
| 200 | - send_line: unset var; echo "${var:+set}" |
| 201 | expect_output: '' |
| 202 | match_type: exact |
| 203 | - name: '220. PARAMETER EXPANSION - EMPTY VS UNSET: + empty var' |
| 204 | steps: |
| 205 | - send_line: var=""; echo "${var+set}" |
| 206 | expect_output: set |
| 207 | match_type: contains |
| 208 | auto_fixed: shell_execution |
| 209 | - name: '220. PARAMETER EXPANSION - EMPTY VS UNSET: + unset var' |
| 210 | steps: |
| 211 | - send_line: unset var; echo "${var+set}" |
| 212 | expect_output: '' |
| 213 | match_type: exact |
| 214 | - name: '220. PARAMETER EXPANSION - EMPTY VS UNSET: :- empty var' |
| 215 | steps: |
| 216 | - send_line: var=""; echo "${var:-default}" |
| 217 | expect_output: default |
| 218 | match_type: contains |
| 219 | auto_fixed: shell_execution |
| 220 | - name: '220. PARAMETER EXPANSION - EMPTY VS UNSET: - empty var' |
| 221 | steps: |
| 222 | - send_line: var=""; echo "${var-default}" |
| 223 | expect_output: '' |
| 224 | match_type: exact |
| 225 | - name: '221. PARAMETER EXPANSION - ASSIGNMENT FORMS: := assigns when empty' |
| 226 | steps: |
| 227 | - send_line: unset var; echo "${var:=default}"; echo "$var" |
| 228 | expect_output: default |
| 229 | match_type: contains |
| 230 | auto_fixed: shell_execution |
| 231 | - name: '221. PARAMETER EXPANSION - ASSIGNMENT FORMS: = assigns when unset' |
| 232 | steps: |
| 233 | - send_line: unset var; echo "${var=default}"; echo "$var" |
| 234 | expect_output: default |
| 235 | match_type: contains |
| 236 | auto_fixed: shell_execution |
| 237 | - name: '221. PARAMETER EXPANSION - ASSIGNMENT FORMS: := with empty' |
| 238 | steps: |
| 239 | - send_line: var=""; echo "${var:=default}"; echo "$var" |
| 240 | expect_output: default |
| 241 | match_type: contains |
| 242 | auto_fixed: shell_execution |
| 243 | - name: '221. PARAMETER EXPANSION - ASSIGNMENT FORMS: = with empty' |
| 244 | steps: |
| 245 | - send_line: var=""; echo "${var=default}"; echo "$var" |
| 246 | expect_output: '' |
| 247 | match_type: exact |
| 248 | - name: '222. PARAMETER EXPANSION - PATTERN IN EXPANSION: nested pattern removal' |
| 249 | steps: |
| 250 | - send_line: suffix=.txt; file=test.txt; echo "${file%$suffix}" |
| 251 | expect_output: test |
| 252 | match_type: contains |
| 253 | auto_fixed: shell_execution |
| 254 | - name: '222. PARAMETER EXPANSION - PATTERN IN EXPANSION: var in pattern' |
| 255 | steps: |
| 256 | - send_line: pat=t; var=test; echo "${var#$pat}" |
| 257 | expect_output: est |
| 258 | match_type: contains |
| 259 | auto_fixed: shell_execution |
| 260 | - name: '222. PARAMETER EXPANSION - PATTERN IN EXPANSION: var in suffix pattern' |
| 261 | steps: |
| 262 | - send_line: pat=st; var=test; echo "${var%$pat}" |
| 263 | expect_output: te |
| 264 | match_type: contains |
| 265 | auto_fixed: shell_execution |
| 266 | - name: '230. TRAP - IGNORE VS RESET: trap ignore' |
| 267 | steps: |
| 268 | - send_line: trap "" INT; trap; trap - INT; trap |
| 269 | expect_output: trap -- '' SIGINT |
| 270 | match_type: contains |
| 271 | auto_fixed: shell_execution |
| 272 | - name: '230. TRAP - IGNORE VS RESET: trap reset' |
| 273 | steps: |
| 274 | - send_line: trap "echo caught" INT; trap - INT; trap |
| 275 | expect_output: '' |
| 276 | match_type: exact |
| 277 | - name: '230. TRAP - IGNORE VS RESET: trap empty string' |
| 278 | steps: |
| 279 | - send_line: trap "" EXIT; echo done |
| 280 | expect_output: done |
| 281 | match_type: contains |
| 282 | - name: '231. TRAP - IN SUBSHELLS: trap not inherited' |
| 283 | steps: |
| 284 | - send_line: trap "echo trap" EXIT; (trap); echo done |
| 285 | expect_output: done |
| 286 | match_type: contains |
| 287 | - name: '231. TRAP - IN SUBSHELLS: ignore trap inherited' |
| 288 | steps: |
| 289 | - send_line: trap "" INT; (trap) |
| 290 | expect_output: trap -- '' SIGINT |
| 291 | match_type: contains |
| 292 | auto_fixed: shell_execution |
| 293 | - name: '232. TRAP - MULTIPLE SIGNALS: trap multiple' |
| 294 | steps: |
| 295 | - send_line: trap "echo exit" EXIT; trap "echo err" ERR 2>/dev/null || true; echo |
| 296 | done |
| 297 | expect_output: done |
| 298 | match_type: contains |
| 299 | - name: '240. SET -e EDGE CASES: set -e with &&' |
| 300 | steps: |
| 301 | - send_line: set -e; false && true; echo reached |
| 302 | expect_output: reached |
| 303 | match_type: contains |
| 304 | - name: '240. SET -e EDGE CASES: set -e with ||' |
| 305 | steps: |
| 306 | - send_line: set -e; false || true; echo reached |
| 307 | expect_output: reached |
| 308 | match_type: contains |
| 309 | - name: '240. SET -e EDGE CASES: set -e with !' |
| 310 | steps: |
| 311 | - send_line: set -e; ! false; echo reached |
| 312 | expect_output: reached |
| 313 | match_type: contains |
| 314 | - name: '240. SET -e EDGE CASES: set -e in if condition' |
| 315 | steps: |
| 316 | - send_line: set -e; if false; then echo no; fi; echo reached |
| 317 | expect_output: reached |
| 318 | match_type: contains |
| 319 | - name: '240. SET -e EDGE CASES: set -e in while condition' |
| 320 | steps: |
| 321 | - send_line: set -e; while false; do echo no; done; echo reached |
| 322 | expect_output: reached |
| 323 | match_type: contains |
| 324 | - name: '241. SET -e IN SUBSHELLS: set -e inherited' |
| 325 | steps: |
| 326 | - send_line: set -e; (false; echo no) || echo caught |
| 327 | expect_output: caught |
| 328 | match_type: contains |
| 329 | - name: '241. SET -e IN SUBSHELLS: set -e in command sub' |
| 330 | steps: |
| 331 | - send_line: set -e; x=$(false; echo yes); echo "x=$x" |
| 332 | expect_output: '' |
| 333 | match_type: exact |
| 334 | - name: '242. COMMAND NOT FOUND: command not found status' |
| 335 | steps: |
| 336 | - send_line: $test_cmd |
| 337 | expect_output: '' |
| 338 | match_type: exact |
| 339 | - name: '250. FUNCTION - BUILTIN SHADOWING: function shadows builtin' |
| 340 | steps: |
| 341 | - send_line: 'echo() { printf "custom: %s\n" "$1"; }; echo test; unset -f echo' |
| 342 | expect_output: 'custom: test' |
| 343 | match_type: contains |
| 344 | auto_fixed: shell_execution |
| 345 | - name: '250. FUNCTION - BUILTIN SHADOWING: function named cd' |
| 346 | steps: |
| 347 | - send_line: cd() { echo "custom cd"; }; cd /tmp; unset -f cd |
| 348 | expect_output: custom cd |
| 349 | match_type: contains |
| 350 | auto_fixed: shell_execution |
| 351 | - name: '251. FUNCTION - REDEFINITION: redefine function' |
| 352 | steps: |
| 353 | - send_line: f() { echo v1; }; f; f() { echo v2; }; f |
| 354 | expect_output: v1 |
| 355 | match_type: contains |
| 356 | auto_fixed: shell_execution |
| 357 | - name: '252. FUNCTION - INDIRECT RECURSION: mutual recursion' |
| 358 | steps: |
| 359 | - send_line: a() { [ $1 -le 0 ] && echo done || b $(($1-1)); }; b() { a $1; }; a |
| 360 | 3 |
| 361 | expect_output: done |
| 362 | match_type: contains |
| 363 | auto_fixed: shell_execution |
| 364 | - name: '253. FUNCTION - RETURN EDGE CASES: return outside function' |
| 365 | steps: |
| 366 | - send_line: (return 5 2>/dev/null); echo $? |
| 367 | expect_output: '2' |
| 368 | match_type: contains |
| 369 | auto_fixed: shell_execution |
| 370 | - name: '253. FUNCTION - RETURN EDGE CASES: return in sourced file' |
| 371 | steps: |
| 372 | - send_line: echo "return 42" > /tmp/ret.sh; . /tmp/ret.sh; echo $?; rm /tmp/ret.sh |
| 373 | expect_output: '42' |
| 374 | match_type: contains |
| 375 | auto_fixed: shell_execution |
| 376 | - name: '260. REDIRECTION - CLOSED FD OPERATIONS: write to closed fd' |
| 377 | steps: |
| 378 | - send_line: exec 3>&-; echo test >&3 2>&1 | head -1 |
| 379 | expect_output: Bad file descriptor |
| 380 | match_type: contains |
| 381 | - name: '260. REDIRECTION - CLOSED FD OPERATIONS: read from closed fd' |
| 382 | steps: |
| 383 | - send_line: exec 3<&-; cat <&3 2>&1 | head -1 |
| 384 | expect_output: '' |
| 385 | match_type: exact |
| 386 | - name: '262. REDIRECTION - NOCLOBBER WITH APPEND: noclobber allows append' |
| 387 | steps: |
| 388 | - send_line: set -C; echo a > /tmp/nc_test; echo b >> /tmp/nc_test; cat /tmp/nc_test; rm /tmp/nc_test |
| 389 | expect_output: a |
| 390 | match_type: contains |
| 391 | auto_fixed: shell_execution |
| 392 | - name: '270. PIPELINE - BUILTIN ONLY: pipeline all builtins' |
| 393 | steps: |
| 394 | - send_line: 'echo test | { read x; echo "got: $x"; }' |
| 395 | expect_output: 'got: test' |
| 396 | match_type: contains |
| 397 | auto_fixed: shell_execution |
| 398 | - name: '270. PIPELINE - BUILTIN ONLY: pipeline with :' |
| 399 | steps: |
| 400 | - send_line: ': | echo piped' |
| 401 | expect_output: piped |
| 402 | match_type: contains |
| 403 | auto_fixed: shell_execution |
| 404 | - name: '271. PIPELINE - LONG CHAINS: 5-stage pipeline' |
| 405 | steps: |
| 406 | - send_line: echo test | cat | cat | cat | cat | cat |
| 407 | expect_output: test |
| 408 | match_type: contains |
| 409 | - name: '271. PIPELINE - LONG CHAINS: pipeline with failures' |
| 410 | steps: |
| 411 | - send_line: echo ok | false | cat; echo $? |
| 412 | expect_output: '0' |
| 413 | match_type: contains |
| 414 | auto_fixed: shell_execution |
| 415 | - name: '280. ALIAS - SPECIAL CASES: alias with quotes' |
| 416 | steps: |
| 417 | - send_line: alias greet='echo hello'; greet; unalias greet |
| 418 | expect_output: '' |
| 419 | match_type: exact |
| 420 | - name: '280. ALIAS - SPECIAL CASES: alias with semicolon' |
| 421 | steps: |
| 422 | - send_line: alias both='echo a; echo b'; both; unalias both |
| 423 | expect_output: '' |
| 424 | match_type: exact |
| 425 | - name: '280. ALIAS - SPECIAL CASES: alias -p format' |
| 426 | steps: |
| 427 | - send_line: alias foo=bar; alias -p | grep foo; unalias foo |
| 428 | expect_output: alias foo='bar' |
| 429 | match_type: contains |
| 430 | auto_fixed: shell_execution |
| 431 | - name: '281. ALIAS - EXPANSION CONTEXT: alias in function' |
| 432 | steps: |
| 433 | - send_line: alias e=echo; f() { e test; }; f; unalias e |
| 434 | expect_output: '' |
| 435 | match_type: exact |
| 436 | - name: '290. DOT - PATH HANDLING: dot with arguments' |
| 437 | steps: |
| 438 | - send_line: 'echo "echo sourced" > /tmp/src.sh; . /tmp/src.sh; rm /tmp/src.sh' |
| 439 | expect_output: 'sourced' |
| 440 | match_type: contains |
| 441 | auto_fixed: shell_execution |
| 442 | - name: '290. DOT - PATH HANDLING: dot return value' |
| 443 | steps: |
| 444 | - send_line: echo "false" > /tmp/src.sh; . /tmp/src.sh; echo $?; rm /tmp/src.sh |
| 445 | expect_output: '1' |
| 446 | match_type: contains |
| 447 | auto_fixed: shell_execution |
| 448 | - name: '290. DOT - PATH HANDLING: dot modifies vars' |
| 449 | steps: |
| 450 | - send_line: echo "X=modified" > /tmp/src.sh; X=original; . /tmp/src.sh; echo $X; |
| 451 | rm /tmp/src.sh |
| 452 | expect_output: modified |
| 453 | match_type: contains |
| 454 | auto_fixed: shell_execution |
| 455 | - name: '300. SPECIAL BUILTINS - ERROR BEHAVIOR: break outside loop' |
| 456 | steps: |
| 457 | - send_line: (break 2>/dev/null); echo $? |
| 458 | expect_output: '0' |
| 459 | match_type: contains |
| 460 | auto_fixed: shell_execution |
| 461 | - name: '300. SPECIAL BUILTINS - ERROR BEHAVIOR: continue outside loop' |
| 462 | steps: |
| 463 | - send_line: (continue 2>/dev/null); echo $? |
| 464 | expect_output: '0' |
| 465 | match_type: contains |
| 466 | auto_fixed: shell_execution |
| 467 | - name: '300. SPECIAL BUILTINS - ERROR BEHAVIOR: colon with redirect' |
| 468 | steps: |
| 469 | - send_line: ': > /tmp/colon_test; test -f /tmp/colon_test && echo exists; rm /tmp/colon_test' |
| 470 | expect_output: exists |
| 471 | match_type: contains |
| 472 | auto_fixed: shell_execution |
| 473 | - name: '310. ENVIRONMENT - PATH HANDLING: empty PATH component' |
| 474 | steps: |
| 475 | - send_line: echo "echo found" > /tmp/pathtest; chmod +x /tmp/pathtest; PATH="/tmp:$PATH" |
| 476 | pathtest; rm /tmp/pathtest |
| 477 | expect_output: found |
| 478 | match_type: contains |
| 479 | auto_fixed: shell_execution |
| 480 | - name: '311. ENVIRONMENT - EXPORT BEHAVIOR: export in subshell' |
| 481 | steps: |
| 482 | - send_line: X=1; (export X=2); echo $X |
| 483 | expect_output: '1' |
| 484 | match_type: contains |
| 485 | auto_fixed: shell_execution |
| 486 | - name: '311. ENVIRONMENT - EXPORT BEHAVIOR: export preserves' |
| 487 | steps: |
| 488 | - send_line: export X=1; X=2; sh -c "echo $X" |
| 489 | expect_output: '2' |
| 490 | match_type: contains |
| 491 | auto_fixed: shell_execution |
| 492 | - name: '320. GLOB - SPECIAL FILENAMES: glob with spaces' |
| 493 | steps: |
| 494 | - send_line: mkdir -p /tmp/gt; touch "/tmp/gt/a b"; echo /tmp/gt/*; rm -r /tmp/gt |
| 495 | expect_output: /tmp/gt/a b |
| 496 | match_type: contains |
| 497 | auto_fixed: shell_execution |
| 498 | - name: '320. GLOB - SPECIAL FILENAMES: glob no match' |
| 499 | steps: |
| 500 | - send_line: echo /nonexistent/path/*.xyz 2>/dev/null |
| 501 | expect_output: '/nonexistent/path/\*.xyz' |
| 502 | match_type: regex |
| 503 | - name: '321. GLOB - CHARACTER CLASSES: glob [:alpha:]' |
| 504 | steps: |
| 505 | - send_line: mkdir -p /tmp/gc; touch /tmp/gc/a1 /tmp/gc/1a; echo /tmp/gc/[[:alpha:]]*; |
| 506 | rm -r /tmp/gc |
| 507 | expect_output: /tmp/gc/a1 |
| 508 | match_type: contains |
| 509 | auto_fixed: shell_execution |
| 510 | - name: '321. GLOB - CHARACTER CLASSES: glob [:digit:]' |
| 511 | steps: |
| 512 | - send_line: mkdir -p /tmp/gc; touch /tmp/gc/a1 /tmp/gc/1a; echo /tmp/gc/[[:digit:]]*; |
| 513 | rm -r /tmp/gc |
| 514 | expect_output: /tmp/gc/1a |
| 515 | match_type: contains |
| 516 | auto_fixed: shell_execution |
| 517 | - name: '330. QUOTING - COMPLEX NESTING: quotes in command sub' |
| 518 | steps: |
| 519 | - send_line: echo "$(echo "inner")" |
| 520 | expect_output: inner |
| 521 | match_type: contains |
| 522 | auto_fixed: shell_execution |
| 523 | - name: '330. QUOTING - COMPLEX NESTING: escaped quotes' |
| 524 | steps: |
| 525 | - send_line: echo "say \"hello\"" |
| 526 | expect_output: say "hello" |
| 527 | match_type: contains |
| 528 | - name: '330. QUOTING - COMPLEX NESTING: single in double' |
| 529 | steps: |
| 530 | - send_line: echo "it's fine" |
| 531 | expect_output: "it's fine" |
| 532 | match_type: contains |
| 533 | - name: '330. QUOTING - COMPLEX NESTING: backslash in single' |
| 534 | steps: |
| 535 | - send_line: echo 'back\\slash' |
| 536 | expect_output: 'back\\\\slash' |
| 537 | match_type: regex |
| 538 | - name: '331. QUOTING - EMPTY STRINGS: empty preserves arg' |
| 539 | steps: |
| 540 | - send_line: set -- "" "a"; echo $# |
| 541 | expect_output: '2' |
| 542 | match_type: contains |
| 543 | auto_fixed: shell_execution |
| 544 | - name: '331. QUOTING - EMPTY STRINGS: unquoted empty gone' |
| 545 | steps: |
| 546 | - send_line: e=""; set -- $e a; echo $# |
| 547 | expect_output: '1' |
| 548 | match_type: contains |
| 549 | auto_fixed: shell_execution |
| 550 | - name: '340. MISC - COMPOUND COMMANDS: if with compound cond' |
| 551 | steps: |
| 552 | - send_line: if true && true; then echo yes; fi |
| 553 | expect_output: 'yes' |
| 554 | match_type: contains |
| 555 | auto_fixed: shell_execution |
| 556 | - name: '340. MISC - COMPOUND COMMANDS: while with pipeline cond' |
| 557 | steps: |
| 558 | - send_line: n=0; while echo $n | grep -q 0 && [ $n -lt 1 ]; do n=$((n+1)); done; |
| 559 | echo $n |
| 560 | expect_output: '1' |
| 561 | match_type: contains |
| 562 | auto_fixed: shell_execution |
| 563 | - name: '341. MISC - COMPLEX COMBINATIONS: redirect in loop' |
| 564 | steps: |
| 565 | - send_line: for i in 1 2 3; do echo $i; done > /tmp/loop_out; cat /tmp/loop_out; rm /tmp/loop_out |
| 566 | expect_output: '1' |
| 567 | match_type: contains |
| 568 | auto_fixed: shell_execution |
| 569 | - name: '341. MISC - COMPLEX COMBINATIONS: case with patterns' |
| 570 | steps: |
| 571 | - send_line: x=abc; case $x in a*) echo match;; esac |
| 572 | expect_output: match |
| 573 | match_type: contains |
| 574 | auto_fixed: shell_execution |
| 575 |