| 1 | metadata: |
| 2 | category: Test |
| 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: '1. POSIX BASIC COMMANDS: echo simple' |
| 8 | steps: |
| 9 | - send_line: echo hello |
| 10 | expect_output: hello |
| 11 | match_type: contains |
| 12 | - name: '1. POSIX BASIC COMMANDS: echo with args' |
| 13 | steps: |
| 14 | - send_line: echo one two three |
| 15 | expect_output: one two three |
| 16 | match_type: contains |
| 17 | - name: '1. POSIX BASIC COMMANDS: printf basic' |
| 18 | steps: |
| 19 | - send_line: printf 'test\n' |
| 20 | expect_output: test |
| 21 | match_type: contains |
| 22 | auto_fixed: shell_execution |
| 23 | - name: '1. POSIX BASIC COMMANDS: printf with args' |
| 24 | steps: |
| 25 | - send_line: printf '%s %d\n' hello 42 |
| 26 | expect_output: hello 42 |
| 27 | match_type: contains |
| 28 | auto_fixed: shell_execution |
| 29 | - name: '2. POSIX VARIABLE EXPANSION: simple variable' |
| 30 | steps: |
| 31 | - send_line: VAR=test; echo $VAR |
| 32 | expect_output: test |
| 33 | match_type: contains |
| 34 | - name: '2. POSIX VARIABLE EXPANSION: variable in quotes' |
| 35 | steps: |
| 36 | - send_line: VAR=test; echo "$VAR" |
| 37 | expect_output: test |
| 38 | match_type: contains |
| 39 | - name: '2. POSIX VARIABLE EXPANSION: multiple vars' |
| 40 | steps: |
| 41 | - send_line: A=hello; B=world; echo $A $B |
| 42 | expect_output: hello world |
| 43 | match_type: contains |
| 44 | - name: '2. POSIX VARIABLE EXPANSION: undefined variable' |
| 45 | steps: |
| 46 | - send_line: echo $UNDEFINED_VAR_XYZ_987 |
| 47 | expect_output: '' |
| 48 | match_type: exact |
| 49 | - name: '3. POSIX PARAMETER EXPANSION: default value' |
| 50 | steps: |
| 51 | - send_line: echo "${UNSET:-default}" |
| 52 | expect_output: default |
| 53 | match_type: contains |
| 54 | - name: '3. POSIX PARAMETER EXPANSION: assign default' |
| 55 | steps: |
| 56 | - send_line: UNSET=; echo "${UNSET:=assigned}"; echo $UNSET |
| 57 | expect_output: assigned |
| 58 | match_type: contains |
| 59 | - name: '3. POSIX PARAMETER EXPANSION: error if unset' |
| 60 | steps: |
| 61 | - send_line: echo "${VAR:+alternative}" |
| 62 | expect_output: '' |
| 63 | match_type: exact |
| 64 | - name: '3. POSIX PARAMETER EXPANSION: string length' |
| 65 | steps: |
| 66 | - send_line: VAR=hello; echo "${#VAR}" |
| 67 | expect_output: '5' |
| 68 | match_type: contains |
| 69 | - name: '3. POSIX PARAMETER EXPANSION: remove shortest prefix' |
| 70 | steps: |
| 71 | - send_line: VAR=foo.bar.baz; echo "${VAR#*.}" |
| 72 | expect_output: bar.baz |
| 73 | match_type: contains |
| 74 | - name: '3. POSIX PARAMETER EXPANSION: remove longest prefix' |
| 75 | steps: |
| 76 | - send_line: VAR=foo.bar.baz; echo "${VAR##*.}" |
| 77 | expect_output: baz |
| 78 | match_type: contains |
| 79 | auto_fixed: shell_execution |
| 80 | - name: '3. POSIX PARAMETER EXPANSION: prefix no match' |
| 81 | steps: |
| 82 | - send_line: VAR=hello; echo "${VAR#x*}" |
| 83 | expect_output: hello |
| 84 | match_type: contains |
| 85 | auto_fixed: shell_execution |
| 86 | - name: '3. POSIX PARAMETER EXPANSION: prefix remove slash' |
| 87 | steps: |
| 88 | - send_line: VAR=/usr/local/bin; echo "${VAR#/*/}" |
| 89 | expect_output: local/bin |
| 90 | match_type: contains |
| 91 | auto_fixed: shell_execution |
| 92 | - name: '3. POSIX PARAMETER EXPANSION: remove shortest suffix' |
| 93 | steps: |
| 94 | - send_line: VAR=foo.bar.baz; echo "${VAR%.*}" |
| 95 | expect_output: foo.bar |
| 96 | match_type: contains |
| 97 | auto_fixed: shell_execution |
| 98 | - name: '3. POSIX PARAMETER EXPANSION: remove longest suffix' |
| 99 | steps: |
| 100 | - send_line: VAR=foo.bar.baz; echo "${VAR%%.*}" |
| 101 | expect_output: foo |
| 102 | match_type: contains |
| 103 | auto_fixed: shell_execution |
| 104 | - name: '3. POSIX PARAMETER EXPANSION: suffix no match' |
| 105 | steps: |
| 106 | - send_line: VAR=hello; echo "${VAR%x*}" |
| 107 | expect_output: hello |
| 108 | match_type: contains |
| 109 | auto_fixed: shell_execution |
| 110 | - name: '3. POSIX PARAMETER EXPANSION: suffix remove extension' |
| 111 | steps: |
| 112 | - send_line: VAR=file.tar.gz; echo "${VAR%.gz}" |
| 113 | expect_output: file.tar |
| 114 | match_type: contains |
| 115 | auto_fixed: shell_execution |
| 116 | - name: '4. POSIX COMMAND SUBSTITUTION: backtick substitution' |
| 117 | steps: |
| 118 | - send_line: echo `echo test` |
| 119 | expect_output: test |
| 120 | match_type: contains |
| 121 | - name: '4. POSIX COMMAND SUBSTITUTION: dollar paren substitution' |
| 122 | steps: |
| 123 | - send_line: echo $(echo test) |
| 124 | expect_output: test |
| 125 | match_type: contains |
| 126 | - name: '4. POSIX COMMAND SUBSTITUTION: nested substitution' |
| 127 | steps: |
| 128 | - send_line: echo $(echo $(echo nested)) |
| 129 | expect_output: nested |
| 130 | match_type: contains |
| 131 | auto_fixed: shell_execution |
| 132 | - name: '5. POSIX ARITHMETIC: expr addition' |
| 133 | steps: |
| 134 | - send_line: expr 5 + 3 |
| 135 | expect_output: '8' |
| 136 | match_type: contains |
| 137 | auto_fixed: shell_execution |
| 138 | - name: '5. POSIX ARITHMETIC: expr multiplication' |
| 139 | steps: |
| 140 | - send_line: expr 4 \* 3 |
| 141 | expect_output: '12' |
| 142 | match_type: contains |
| 143 | auto_fixed: shell_execution |
| 144 | - name: '5. POSIX ARITHMETIC: expr division' |
| 145 | steps: |
| 146 | - send_line: expr 15 / 3 |
| 147 | expect_output: '5' |
| 148 | match_type: contains |
| 149 | auto_fixed: shell_execution |
| 150 | - name: '6. POSIX REDIRECTION: output redirect' |
| 151 | steps: |
| 152 | - send_line: echo test > /tmp/posix_test_out; cat /tmp/posix_test_out |
| 153 | expect_output: test |
| 154 | match_type: contains |
| 155 | - name: '6. POSIX REDIRECTION: append redirect' |
| 156 | steps: |
| 157 | - send_line: echo line1 > /tmp/posix_test_app; echo line2 >> /tmp/posix_test_app; wc -l < /tmp/posix_test_app |
| 158 | expect_output: '2' |
| 159 | match_type: contains |
| 160 | - name: '6. POSIX REDIRECTION: input redirect' |
| 161 | steps: |
| 162 | - send_line: echo input > /tmp/posix_test_in; cat < /tmp/posix_test_in |
| 163 | expect_output: input |
| 164 | match_type: contains |
| 165 | - name: '6. POSIX REDIRECTION: stderr redirect' |
| 166 | steps: |
| 167 | - send_line: ls /nonexistent 2>&1 | grep -c 'cannot access\|No such\|not found' |
| 168 | expect_output: '1' |
| 169 | match_type: contains |
| 170 | - name: '7. POSIX PIPELINES: simple pipe' |
| 171 | steps: |
| 172 | - send_line: echo hello | cat |
| 173 | expect_output: hello |
| 174 | match_type: contains |
| 175 | - name: '7. POSIX PIPELINES: two-stage pipe' |
| 176 | steps: |
| 177 | - send_line: echo test | cat | tr t T |
| 178 | expect_output: TesT |
| 179 | match_type: contains |
| 180 | - name: '7. POSIX PIPELINES: pipe with filter' |
| 181 | steps: |
| 182 | - send_line: printf 'a\nb\nc\n' | grep b |
| 183 | expect_output: b |
| 184 | match_type: contains |
| 185 | auto_fixed: shell_execution |
| 186 | - name: '8. POSIX TEST COMMAND: test -f file (exit code)' |
| 187 | steps: |
| 188 | - send_line: touch /tmp/posix_test_file && test -f /tmp/posix_test_file |
| 189 | - send_line: echo "EXIT=$?" |
| 190 | expect_output: EXIT=0 |
| 191 | match_type: contains |
| 192 | - name: '8. POSIX TEST COMMAND: test -d directory (exit code)' |
| 193 | steps: |
| 194 | - send_line: test -d /tmp |
| 195 | - send_line: echo "EXIT=$?" |
| 196 | expect_output: EXIT=0 |
| 197 | match_type: contains |
| 198 | - name: '8. POSIX TEST COMMAND: test -n nonempty (exit code)' |
| 199 | steps: |
| 200 | - send_line: test -n 'hello' |
| 201 | - send_line: echo "EXIT=$?" |
| 202 | expect_output: EXIT=0 |
| 203 | match_type: contains |
| 204 | - name: '8. POSIX TEST COMMAND: test -z empty (exit code)' |
| 205 | steps: |
| 206 | - send_line: test -z '' |
| 207 | - send_line: echo "EXIT=$?" |
| 208 | expect_output: EXIT=0 |
| 209 | match_type: contains |
| 210 | - name: '8. POSIX TEST COMMAND: test string = (exit code)' |
| 211 | steps: |
| 212 | - send_line: test 'hello' = 'hello' |
| 213 | - send_line: echo "EXIT=$?" |
| 214 | expect_output: EXIT=0 |
| 215 | match_type: contains |
| 216 | - name: '8. POSIX TEST COMMAND: test string != (exit code)' |
| 217 | steps: |
| 218 | - send_line: test 'hello' != 'world' |
| 219 | - send_line: echo "EXIT=$?" |
| 220 | expect_output: EXIT=0 |
| 221 | match_type: contains |
| 222 | - name: '8. POSIX TEST COMMAND: test number -eq (exit code)' |
| 223 | steps: |
| 224 | - send_line: test 5 -eq 5 |
| 225 | - send_line: echo "EXIT=$?" |
| 226 | expect_output: EXIT=0 |
| 227 | match_type: contains |
| 228 | - name: '8. POSIX TEST COMMAND: test number -ne (exit code)' |
| 229 | steps: |
| 230 | - send_line: test 5 -ne 3 |
| 231 | - send_line: echo "EXIT=$?" |
| 232 | expect_output: EXIT=0 |
| 233 | match_type: contains |
| 234 | - name: '8. POSIX TEST COMMAND: test number -gt (exit code)' |
| 235 | steps: |
| 236 | - send_line: test 5 -gt 3 |
| 237 | - send_line: echo "EXIT=$?" |
| 238 | expect_output: EXIT=0 |
| 239 | match_type: contains |
| 240 | - name: '8. POSIX TEST COMMAND: test number -ge (exit code)' |
| 241 | steps: |
| 242 | - send_line: test 5 -ge 5 |
| 243 | - send_line: echo "EXIT=$?" |
| 244 | expect_output: EXIT=0 |
| 245 | match_type: contains |
| 246 | - name: '8. POSIX TEST COMMAND: test number -lt (exit code)' |
| 247 | steps: |
| 248 | - send_line: test 3 -lt 5 |
| 249 | - send_line: echo "EXIT=$?" |
| 250 | expect_output: EXIT=0 |
| 251 | match_type: contains |
| 252 | - name: '8. POSIX TEST COMMAND: test number -le (exit code)' |
| 253 | steps: |
| 254 | - send_line: test 3 -le 3 |
| 255 | - send_line: echo "EXIT=$?" |
| 256 | expect_output: EXIT=0 |
| 257 | match_type: contains |
| 258 | - name: '9. POSIX CONDITIONALS: if true' |
| 259 | steps: |
| 260 | - send_line: if true; then echo yes; fi |
| 261 | expect_output: 'yes' |
| 262 | match_type: contains |
| 263 | auto_fixed: shell_execution |
| 264 | - name: '9. POSIX CONDITIONALS: if false else' |
| 265 | steps: |
| 266 | - send_line: if false; then echo no; else echo yes; fi |
| 267 | expect_output: 'yes' |
| 268 | match_type: contains |
| 269 | auto_fixed: shell_execution |
| 270 | - name: '9. POSIX CONDITIONALS: if-elif-else' |
| 271 | steps: |
| 272 | - send_line: X=2; if [ $X -eq 1 ]; then echo one; elif [ $X -eq 2 ]; then echo two; else echo other; fi |
| 273 | expect_output: two |
| 274 | match_type: contains |
| 275 | - name: '10. POSIX LOOPS: for loop' |
| 276 | steps: |
| 277 | - send_line: for i in a b c; do echo $i; done |
| 278 | expect_output: a |
| 279 | match_type: contains |
| 280 | auto_fixed: shell_execution |
| 281 | - name: '10. POSIX LOOPS: while loop' |
| 282 | steps: |
| 283 | - send_line: i=3; while [ $i -gt 0 ]; do echo $i; i=$((i - 1)); done |
| 284 | expect_output: '3' |
| 285 | match_type: contains |
| 286 | auto_fixed: shell_execution |
| 287 | - name: '10. POSIX LOOPS: until loop' |
| 288 | steps: |
| 289 | - send_line: i=1; until [ $i -gt 3 ]; do echo $i; i=$((i + 1)); done |
| 290 | expect_output: '1' |
| 291 | match_type: contains |
| 292 | auto_fixed: shell_execution |
| 293 | - name: '11. POSIX CASE STATEMENT: case exact match' |
| 294 | steps: |
| 295 | - send_line: x=2; case $x in 1) echo one;; 2) echo two;; esac |
| 296 | expect_output: two |
| 297 | match_type: contains |
| 298 | auto_fixed: shell_execution |
| 299 | - name: '11. POSIX CASE STATEMENT: case pattern match' |
| 300 | steps: |
| 301 | - send_line: x=hello; case $x in h*) echo h_prefix;; esac |
| 302 | expect_output: h_prefix |
| 303 | match_type: contains |
| 304 | auto_fixed: shell_execution |
| 305 | - name: '11. POSIX CASE STATEMENT: case default' |
| 306 | steps: |
| 307 | - send_line: x=z; case $x in a) echo a;; b) echo b;; *) echo default;; esac |
| 308 | expect_output: default |
| 309 | match_type: contains |
| 310 | auto_fixed: shell_execution |
| 311 | - name: '11. POSIX CASE STATEMENT: case multiple patterns' |
| 312 | steps: |
| 313 | - send_line: x=b; case $x in a|b|c) echo abc;; *) echo other;; esac |
| 314 | expect_output: abc |
| 315 | match_type: contains |
| 316 | auto_fixed: shell_execution |
| 317 | - name: '12. POSIX FUNCTIONS: simple function' |
| 318 | steps: |
| 319 | - send_line: func() { echo hello; }; func |
| 320 | expect_output: hello |
| 321 | match_type: contains |
| 322 | auto_fixed: shell_execution |
| 323 | - name: '12. POSIX FUNCTIONS: function with args' |
| 324 | steps: |
| 325 | - send_line: func() { echo $1 $2; }; func foo bar |
| 326 | expect_output: foo bar |
| 327 | match_type: contains |
| 328 | auto_fixed: shell_execution |
| 329 | - name: '12. POSIX FUNCTIONS: function return' |
| 330 | steps: |
| 331 | - send_line: func() { return 42; }; func; echo $? |
| 332 | expect_output: '42' |
| 333 | match_type: contains |
| 334 | auto_fixed: shell_execution |
| 335 | - name: '12. POSIX FUNCTIONS: function \$# args' |
| 336 | steps: |
| 337 | - send_line: func() { echo $#; }; func a b c |
| 338 | expect_output: '3' |
| 339 | match_type: contains |
| 340 | auto_fixed: shell_execution |
| 341 | - name: '13. POSIX SPECIAL VARIABLES: \$? exit status' |
| 342 | steps: |
| 343 | - send_line: true; echo $? |
| 344 | expect_output: '0' |
| 345 | match_type: contains |
| 346 | auto_fixed: shell_execution |
| 347 | - name: '13. POSIX SPECIAL VARIABLES: \$? after false' |
| 348 | steps: |
| 349 | - send_line: false; echo $? |
| 350 | expect_output: '1' |
| 351 | match_type: contains |
| 352 | auto_fixed: shell_execution |
| 353 | - name: '13. POSIX SPECIAL VARIABLES: \$# argument count' |
| 354 | steps: |
| 355 | - send_line: set -- a b c; echo $# |
| 356 | expect_output: '3' |
| 357 | match_type: contains |
| 358 | auto_fixed: shell_execution |
| 359 | - name: '13. POSIX SPECIAL VARIABLES: \$@ all arguments' |
| 360 | steps: |
| 361 | - send_line: set -- a b c; echo $@ |
| 362 | expect_output: a b c |
| 363 | match_type: contains |
| 364 | auto_fixed: shell_execution |
| 365 | - name: '13. POSIX SPECIAL VARIABLES: \$* all arguments' |
| 366 | steps: |
| 367 | - send_line: set -- a b c; echo $* |
| 368 | expect_output: a b c |
| 369 | match_type: contains |
| 370 | auto_fixed: shell_execution |
| 371 | - name: '13. POSIX SPECIAL VARIABLES: \$0 script name' |
| 372 | steps: |
| 373 | - send_line: echo $0 | grep -c sh |
| 374 | expect_output: '1' |
| 375 | match_type: contains |
| 376 | auto_fixed: shell_execution |
| 377 | - name: '14. POSIX LOGICAL OPERATORS: true && true (exit code)' |
| 378 | steps: |
| 379 | - send_line: true && true |
| 380 | - send_line: echo "EXIT=$?" |
| 381 | expect_output: EXIT=0 |
| 382 | match_type: contains |
| 383 | - name: '14. POSIX LOGICAL OPERATORS: true && false (exit code)' |
| 384 | steps: |
| 385 | - send_line: true && false |
| 386 | - send_line: echo "EXIT=$?" |
| 387 | expect_output: EXIT=1 |
| 388 | match_type: contains |
| 389 | - name: '14. POSIX LOGICAL OPERATORS: false || true (exit code)' |
| 390 | steps: |
| 391 | - send_line: false || true |
| 392 | - send_line: echo "EXIT=$?" |
| 393 | expect_output: EXIT=0 |
| 394 | match_type: contains |
| 395 | - name: '14. POSIX LOGICAL OPERATORS: false || false (exit code)' |
| 396 | steps: |
| 397 | - send_line: false || false |
| 398 | - send_line: echo "EXIT=$?" |
| 399 | expect_output: EXIT=1 |
| 400 | match_type: contains |
| 401 | - name: '14. POSIX LOGICAL OPERATORS: command && echo' |
| 402 | steps: |
| 403 | - send_line: true && echo success |
| 404 | expect_output: success |
| 405 | match_type: contains |
| 406 | auto_fixed: shell_execution |
| 407 | - name: '14. POSIX LOGICAL OPERATORS: command || echo' |
| 408 | steps: |
| 409 | - send_line: false || echo fallback |
| 410 | expect_output: fallback |
| 411 | match_type: contains |
| 412 | auto_fixed: shell_execution |
| 413 | - name: '14. POSIX LOGICAL OPERATORS: ! negation' |
| 414 | steps: |
| 415 | - send_line: '! false && echo negated' |
| 416 | expect_output: negated |
| 417 | match_type: contains |
| 418 | auto_fixed: shell_execution |
| 419 | - name: '15. POSIX QUOTING: single quote literal' |
| 420 | steps: |
| 421 | - send_line: echo '$VAR' |
| 422 | expect_output: \$VAR |
| 423 | match_type: contains |
| 424 | auto_fixed: shell_execution |
| 425 | - name: '15. POSIX QUOTING: double quote expand' |
| 426 | steps: |
| 427 | - send_line: VAR=test; echo "$VAR" |
| 428 | expect_output: test |
| 429 | match_type: contains |
| 430 | - name: '15. POSIX QUOTING: escape in double' |
| 431 | steps: |
| 432 | - send_line: echo "test$var" |
| 433 | expect_output: test |
| 434 | match_type: contains |
| 435 | auto_fixed: shell_execution |
| 436 | - name: '15. POSIX QUOTING: backslash escape' |
| 437 | steps: |
| 438 | - send_line: echo test\ word |
| 439 | expect_output: test word |
| 440 | match_type: contains |
| 441 | - name: '16. POSIX SUBSHELLS: subshell grouping' |
| 442 | steps: |
| 443 | - send_line: (echo a; echo b) | wc -l |
| 444 | expect_output: '2' |
| 445 | match_type: contains |
| 446 | - name: '16. POSIX SUBSHELLS: subshell var isolation' |
| 447 | steps: |
| 448 | - send_line: (VAR=inner; echo $VAR); echo $VAR |
| 449 | expect_output: inner |
| 450 | match_type: contains |
| 451 | auto_fixed: shell_execution |
| 452 | - name: '17. POSIX COMPOUND COMMANDS: command grouping {}' |
| 453 | steps: |
| 454 | - send_line: '{ echo a; echo b; } | wc -l' |
| 455 | expect_output: '2' |
| 456 | match_type: contains |
| 457 | - name: '17. POSIX COMPOUND COMMANDS: command list ;' |
| 458 | steps: |
| 459 | - send_line: echo a; echo b |
| 460 | expect_output: a |
| 461 | match_type: contains |
| 462 | - name: '19. POSIX WORD EXPANSION ORDER: expansion order' |
| 463 | steps: |
| 464 | - send_line: VAR='a b'; echo $VAR |
| 465 | expect_output: a b |
| 466 | match_type: contains |
| 467 | auto_fixed: shell_execution |
| 468 | - name: '19. POSIX WORD EXPANSION ORDER: quoted expansion' |
| 469 | steps: |
| 470 | - send_line: VAR="a b"; echo "$VAR" |
| 471 | expect_output: a b |
| 472 | match_type: contains |
| 473 | - name: '20. POSIX PATHNAME EXPANSION (GLOBBING): glob * pattern' |
| 474 | steps: |
| 475 | - send_line: ls /tmp/posix_test_glob/*.txt 2>/dev/null | wc -l |
| 476 | expect_output: '[0-9]+' |
| 477 | match_type: regex |
| 478 | - name: '20. POSIX PATHNAME EXPANSION (GLOBBING): glob ? pattern' |
| 479 | steps: |
| 480 | - send_line: ls /tmp/posix_test_glob/?.txt 2>/dev/null | wc -l |
| 481 | expect_output: '[0-9]+' |
| 482 | match_type: regex |
| 483 | - name: '20. POSIX PATHNAME EXPANSION (GLOBBING): glob [abc] pattern' |
| 484 | steps: |
| 485 | - send_line: ls /tmp/posix_test_glob/[ab].txt 2>/dev/null | wc -l |
| 486 | expect_output: '[0-9]+' |
| 487 | match_type: regex |
| 488 | - name: '21. POSIX FIELD SPLITTING (IFS): default IFS' |
| 489 | steps: |
| 490 | - send_line: VAR='a b c'; set -- $VAR; echo $# |
| 491 | expect_output: '3' |
| 492 | match_type: contains |
| 493 | auto_fixed: shell_execution |
| 494 | - name: '21. POSIX FIELD SPLITTING (IFS): custom IFS' |
| 495 | steps: |
| 496 | - send_line: IFS=:; VAR='a:b:c'; set -- $VAR; echo $1 |
| 497 | expect_output: a |
| 498 | match_type: contains |
| 499 | auto_fixed: shell_execution |
| 500 | - name: '22. POSIX EXIT STATUS: true exit status (exit code)' |
| 501 | steps: |
| 502 | - send_line: 'true' |
| 503 | - send_line: echo "EXIT=$?" |
| 504 | expect_output: EXIT=0 |
| 505 | match_type: contains |
| 506 | - name: '22. POSIX EXIT STATUS: false exit status (exit code)' |
| 507 | steps: |
| 508 | - send_line: 'false' |
| 509 | - send_line: echo "EXIT=$?" |
| 510 | expect_output: EXIT=1 |
| 511 | match_type: contains |
| 512 | - name: '22. POSIX EXIT STATUS: command not found (exit code)' |
| 513 | steps: |
| 514 | - send_line: nonexistent_command_xyz 2>/dev/null |
| 515 | - send_line: echo "EXIT=$?" |
| 516 | expect_output: EXIT=127 |
| 517 | match_type: contains |
| 518 | - name: '22. POSIX EXIT STATUS: return from function (exit code)' |
| 519 | steps: |
| 520 | - send_line: func() { return 3; }; func |
| 521 | - send_line: echo "EXIT=$?" |
| 522 | expect_output: EXIT=3 |
| 523 | match_type: contains |
| 524 | - name: '23. POSIX SET BUILTIN: set positional' |
| 525 | steps: |
| 526 | - send_line: set -- a b c; echo $1 $2 $3 |
| 527 | expect_output: a |
| 528 | match_type: contains |
| 529 | auto_fixed: shell_execution |
| 530 | - name: '23. POSIX SET BUILTIN: set shift' |
| 531 | steps: |
| 532 | - send_line: set -- a b c; shift; echo $1 |
| 533 | expect_output: b |
| 534 | match_type: contains |
| 535 | auto_fixed: shell_execution |
| 536 | - name: '23. POSIX SET BUILTIN: set shift n' |
| 537 | steps: |
| 538 | - send_line: set -- a b c d; shift 2; echo $1 |
| 539 | expect_output: c |
| 540 | match_type: contains |
| 541 | auto_fixed: shell_execution |
| 542 | - name: '24. POSIX EXPORT: export variable' |
| 543 | steps: |
| 544 | - send_line: export VAR=test; sh -c 'echo $VAR' |
| 545 | expect_output: test |
| 546 | match_type: contains |
| 547 | auto_fixed: shell_execution |
| 548 | - name: '25. POSIX READONLY: readonly assignment (exit code)' |
| 549 | steps: |
| 550 | - send_line: readonly VAR=test; VAR=new 2>/dev/null |
| 551 | - send_line: echo "EXIT=$?" |
| 552 | expect_output: EXIT=1 |
| 553 | match_type: contains |
| 554 |