| 1 | metadata: |
| 2 | category: Gaps |
| 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: '92. REDIRECTION OPERATOR <> (READ/WRITE): redirect <> creates file (exit |
| 8 | code)' |
| 9 | steps: |
| 10 | - send_line: echo test <> /tmp/posix_gaps_rw_$$; test -f /tmp/posix_gaps_rw_$$; |
| 11 | rm -f /tmp/posix_gaps_rw_$$ |
| 12 | - send_line: echo "EXIT=$?" |
| 13 | expect_output: EXIT=0 |
| 14 | match_type: contains |
| 15 | - name: '92. REDIRECTION OPERATOR <> (READ/WRITE): redirect <> opens existing (exit |
| 16 | code)' |
| 17 | steps: |
| 18 | - send_line: echo data > /tmp/posix_gaps_rw2_$$; cat <> /tmp/posix_gaps_rw2_$$ 2>/dev/null; |
| 19 | rm -f /tmp/posix_gaps_rw2_$$ |
| 20 | - send_line: echo "EXIT=$?" |
| 21 | expect_output: EXIT=0 |
| 22 | match_type: contains |
| 23 | - name: '93. COMPLEX IFS FIELD SPLITTING: IFS mixed ws and non-ws' |
| 24 | steps: |
| 25 | - send_line: 'IFS='': \t''; VAR=''a:b c:d''; set -- $VAR; echo $# $1 $2 $3 $4' |
| 26 | expect_output: '4' |
| 27 | match_type: contains |
| 28 | auto_fixed: shell_execution |
| 29 | - name: '93. COMPLEX IFS FIELD SPLITTING: IFS multiple delimiters' |
| 30 | steps: |
| 31 | - send_line: IFS=',:'; VAR='a,b:c,d'; set -- $VAR; echo $# |
| 32 | expect_output: '4' |
| 33 | match_type: contains |
| 34 | auto_fixed: shell_execution |
| 35 | - name: '93. COMPLEX IFS FIELD SPLITTING: IFS trailing delimiters' |
| 36 | steps: |
| 37 | - send_line: IFS=:; VAR='a:b:c:'; set -- $VAR; echo $# |
| 38 | expect_output: '3' |
| 39 | match_type: contains |
| 40 | auto_fixed: shell_execution |
| 41 | - name: '93. COMPLEX IFS FIELD SPLITTING: IFS leading and trailing' |
| 42 | steps: |
| 43 | - send_line: IFS=:; VAR=':a:b:'; set -- $VAR; echo $# $1 $2 |
| 44 | expect_output: '3' |
| 45 | match_type: contains |
| 46 | auto_fixed: shell_execution |
| 47 | - name: '93. COMPLEX IFS FIELD SPLITTING: IFS consecutive delimiters' |
| 48 | steps: |
| 49 | - send_line: IFS=:; VAR='a::b'; set -- $VAR; echo $# $1 $2 $3 |
| 50 | expect_output: '3' |
| 51 | match_type: contains |
| 52 | auto_fixed: shell_execution |
| 53 | - name: '93. COMPLEX IFS FIELD SPLITTING: IFS whitespace collapsing' |
| 54 | steps: |
| 55 | - send_line: IFS=' '; VAR='a b c'; set -- $VAR; echo $# |
| 56 | expect_output: '3' |
| 57 | match_type: contains |
| 58 | auto_fixed: shell_execution |
| 59 | - name: '93. COMPLEX IFS FIELD SPLITTING: IFS null splits nothing' |
| 60 | steps: |
| 61 | - send_line: IFS=''; VAR='a b c'; set -- $VAR; echo $# |
| 62 | expect_output: '1' |
| 63 | match_type: contains |
| 64 | auto_fixed: shell_execution |
| 65 | - name: '94. NESTED PARAMETER EXPANSION: nested default expansion' |
| 66 | steps: |
| 67 | - send_line: unset A; B=inner; echo ${A:-${B}} |
| 68 | expect_output: inner |
| 69 | match_type: contains |
| 70 | auto_fixed: shell_execution |
| 71 | - name: '94. NESTED PARAMETER EXPANSION: nested length expansion' |
| 72 | steps: |
| 73 | - send_line: VAR=hello; echo ${#VAR} |
| 74 | expect_output: '5' |
| 75 | match_type: contains |
| 76 | auto_fixed: shell_execution |
| 77 | - name: '94. NESTED PARAMETER EXPANSION: nested pattern removal' |
| 78 | steps: |
| 79 | - send_line: VAR=/usr/local/bin; echo ${VAR#${VAR%/*}} |
| 80 | expect_output: /bin |
| 81 | match_type: contains |
| 82 | auto_fixed: shell_execution |
| 83 | - name: '94. NESTED PARAMETER EXPANSION: multiple parameter expansions' |
| 84 | steps: |
| 85 | - send_line: A=foo; B=bar; echo ${A}${B} |
| 86 | expect_output: foobar |
| 87 | match_type: contains |
| 88 | auto_fixed: shell_execution |
| 89 | - name: '94. NESTED PARAMETER EXPANSION: nested with quotes' |
| 90 | steps: |
| 91 | - send_line: A='a b'; echo "${A:-default}" |
| 92 | expect_output: a b |
| 93 | match_type: contains |
| 94 | - name: '95. COMMAND NAME RESOLUTION ORDER: function overrides echo' |
| 95 | steps: |
| 96 | - send_line: echo() { printf 'function\n'; }; echo test | grep -c function |
| 97 | expect_output: '1' |
| 98 | match_type: contains |
| 99 | - name: '95. COMMAND NAME RESOLUTION ORDER: command -v finds function' |
| 100 | steps: |
| 101 | - send_line: func() { :; }; command -v func | grep -c func |
| 102 | expect_output: '[0-9]+' |
| 103 | match_type: regex |
| 104 | - name: '95. COMMAND NAME RESOLUTION ORDER: command bypasses function' |
| 105 | steps: |
| 106 | - send_line: echo() { printf 'func\n'; }; command echo test |
| 107 | expect_output: test |
| 108 | match_type: contains |
| 109 | auto_fixed: shell_execution |
| 110 | - name: '95. COMMAND NAME RESOLUTION ORDER: unset function reveals builtin' |
| 111 | steps: |
| 112 | - send_line: echo() { printf 'f\n'; }; unset -f echo; echo test | grep -c test |
| 113 | expect_output: '1' |
| 114 | match_type: contains |
| 115 | - name: '96. COMPLEX QUOTING AND ESCAPING: backslash in double quotes' |
| 116 | steps: |
| 117 | - send_line: echo "test\\nword" |
| 118 | expect_output: test\\nword |
| 119 | match_type: contains |
| 120 | - name: '96. COMPLEX QUOTING AND ESCAPING: dollar in double quotes' |
| 121 | steps: |
| 122 | - send_line: "echo 'price: $5'" |
| 123 | expect_output: 'price:' |
| 124 | match_type: contains |
| 125 | - name: '96. COMPLEX QUOTING AND ESCAPING: backtick in double quotes' |
| 126 | steps: |
| 127 | - send_line: 'echo "date: `date +%Y`" | grep -c date' |
| 128 | expect_output: '1' |
| 129 | match_type: contains |
| 130 | - name: '96. COMPLEX QUOTING AND ESCAPING: mixed quoting' |
| 131 | steps: |
| 132 | - send_line: echo 'single'"double" |
| 133 | expect_output: singledouble |
| 134 | match_type: contains |
| 135 | - name: '96. COMPLEX QUOTING AND ESCAPING: empty quotes concatenation' |
| 136 | steps: |
| 137 | - send_line: echo ''test'' |
| 138 | expect_output: test |
| 139 | match_type: contains |
| 140 | - name: '96. COMPLEX QUOTING AND ESCAPING: quote removal' |
| 141 | steps: |
| 142 | - send_line: VAR="\"test\""; echo $VAR |
| 143 | expect_output: '"test"' |
| 144 | match_type: contains |
| 145 | - name: '97. PIPELINE EXIT STATUS: pipeline last command status (exit code)' |
| 146 | steps: |
| 147 | - send_line: true | true | false |
| 148 | - send_line: echo "EXIT=$?" |
| 149 | expect_output: EXIT=1 |
| 150 | match_type: contains |
| 151 | - name: '97. PIPELINE EXIT STATUS: pipeline first fails (exit code)' |
| 152 | steps: |
| 153 | - send_line: false | true | true |
| 154 | - send_line: echo "EXIT=$?" |
| 155 | expect_output: EXIT=0 |
| 156 | match_type: contains |
| 157 | - name: '97. PIPELINE EXIT STATUS: pipeline middle fails (exit code)' |
| 158 | steps: |
| 159 | - send_line: true | false | true |
| 160 | - send_line: echo "EXIT=$?" |
| 161 | expect_output: EXIT=0 |
| 162 | match_type: contains |
| 163 | - name: '97. PIPELINE EXIT STATUS: PIPESTATUS concept' |
| 164 | steps: |
| 165 | - send_line: false | true | true; echo $? |
| 166 | expect_output: '0' |
| 167 | match_type: contains |
| 168 | auto_fixed: shell_execution |
| 169 | - name: '98. COMPLEX ARITHMETIC EDGE CASES: arithmetic negative numbers' |
| 170 | steps: |
| 171 | - send_line: echo $((-5 * -3)) |
| 172 | expect_output: '15' |
| 173 | match_type: contains |
| 174 | auto_fixed: shell_execution |
| 175 | - name: '98. COMPLEX ARITHMETIC EDGE CASES: arithmetic large numbers' |
| 176 | steps: |
| 177 | - send_line: echo $((999999 + 1)) |
| 178 | expect_output: '1000000' |
| 179 | match_type: contains |
| 180 | auto_fixed: shell_execution |
| 181 | - name: '98. COMPLEX ARITHMETIC EDGE CASES: arithmetic modulo negative' |
| 182 | steps: |
| 183 | - send_line: echo $((-17 % 5)) |
| 184 | expect_output: '-2' |
| 185 | match_type: contains |
| 186 | auto_fixed: shell_execution |
| 187 | - name: '98. COMPLEX ARITHMETIC EDGE CASES: arithmetic nested parens' |
| 188 | steps: |
| 189 | - send_line: echo $(((2 + 3) * (4 + 5))) |
| 190 | expect_output: '45' |
| 191 | match_type: contains |
| 192 | auto_fixed: shell_execution |
| 193 | - name: '98. COMPLEX ARITHMETIC EDGE CASES: arithmetic comparison chain' |
| 194 | steps: |
| 195 | - send_line: echo $((5 > 3 && 10 > 8)) |
| 196 | expect_output: '1' |
| 197 | match_type: contains |
| 198 | auto_fixed: shell_execution |
| 199 | - name: '98. COMPLEX ARITHMETIC EDGE CASES: arithmetic unary minus' |
| 200 | steps: |
| 201 | - send_line: X=5; echo $((-X)) |
| 202 | expect_output: '-5' |
| 203 | match_type: contains |
| 204 | auto_fixed: shell_execution |
| 205 | - name: '98. COMPLEX ARITHMETIC EDGE CASES: arithmetic unary plus' |
| 206 | steps: |
| 207 | - send_line: X=5; echo $((+X)) |
| 208 | expect_output: '5' |
| 209 | match_type: contains |
| 210 | auto_fixed: shell_execution |
| 211 | - name: '98. COMPLEX ARITHMETIC EDGE CASES: arithmetic octal numbers' |
| 212 | steps: |
| 213 | - send_line: echo $((010)) |
| 214 | expect_output: '8' |
| 215 | match_type: contains |
| 216 | auto_fixed: shell_execution |
| 217 | - name: '98. COMPLEX ARITHMETIC EDGE CASES: arithmetic hex numbers' |
| 218 | steps: |
| 219 | - send_line: echo $((0x10)) |
| 220 | expect_output: '16' |
| 221 | match_type: contains |
| 222 | auto_fixed: shell_execution |
| 223 | - name: '98. COMPLEX ARITHMETIC EDGE CASES: arithmetic division by zero (exit code)' |
| 224 | steps: |
| 225 | - send_line: echo $((5 / 0)) 2>/dev/null |
| 226 | - send_line: echo "EXIT=$?" |
| 227 | expect_output: EXIT=1 |
| 228 | match_type: contains |
| 229 | - name: '99. PATHNAME EXPANSION EDGE CASES: glob bracket literal' |
| 230 | steps: |
| 231 | - send_line: ls /tmp/posix_gaps_test_glob/file[[]3].txt 2>/dev/null | wc -l |
| 232 | expect_output: '[0-9]+' |
| 233 | match_type: regex |
| 234 | - name: '99. PATHNAME EXPANSION EDGE CASES: glob dash in bracket' |
| 235 | steps: |
| 236 | - send_line: ls /tmp/posix_gaps_test_glob/[-a-z]file.txt 2>/dev/null | wc -l |
| 237 | expect_output: '[0-9]+' |
| 238 | match_type: regex |
| 239 | - name: '99. PATHNAME EXPANSION EDGE CASES: glob no match returns literal' |
| 240 | steps: |
| 241 | - send_line: echo /tmp/posix_gaps_test_glob/*.xyz | grep -c '\*' |
| 242 | expect_output: '1' |
| 243 | match_type: contains |
| 244 | - name: '99. PATHNAME EXPANSION EDGE CASES: glob hidden dirs' |
| 245 | steps: |
| 246 | - send_line: ls -d /tmp/posix_gaps_test_glob/.* 2>/dev/null | grep -c hidden |
| 247 | expect_output: '[0-9]+' |
| 248 | match_type: regex |
| 249 | - name: '99. PATHNAME EXPANSION EDGE CASES: glob character class digit' |
| 250 | steps: |
| 251 | - send_line: touch /tmp/posix_gaps_test_glob/f1.txt; ls /tmp/posix_gaps_test_glob/f[[:digit:]].txt |
| 252 | 2>/dev/null | wc -l |
| 253 | expect_output: '[0-9]+' |
| 254 | match_type: regex |
| 255 | - name: '100. FUNCTION SCOPE AND RECURSION EDGE CASES: function local scope via subshell' |
| 256 | steps: |
| 257 | - send_line: f() { (X=inner; echo $X); }; X=outer; f; echo $X |
| 258 | expect_output: inner |
| 259 | match_type: contains |
| 260 | - name: '100. FUNCTION SCOPE AND RECURSION EDGE CASES: function positional params' |
| 261 | steps: |
| 262 | - send_line: f() { echo $1 $2; }; set -- a b; f x y |
| 263 | expect_output: x y |
| 264 | match_type: contains |
| 265 | - name: '100. FUNCTION SCOPE AND RECURSION EDGE CASES: function preserves positional' |
| 266 | steps: |
| 267 | - send_line: f() { echo $1; }; set -- a b; f x; echo $1 |
| 268 | expect_output: 'x' |
| 269 | match_type: contains |
| 270 | - name: '100. FUNCTION SCOPE AND RECURSION EDGE CASES: nested function calls' |
| 271 | steps: |
| 272 | - send_line: a() { b; }; b() { c; }; c() { echo deep; }; a |
| 273 | expect_output: deep |
| 274 | match_type: contains |
| 275 | auto_fixed: shell_execution |
| 276 | - name: '100. FUNCTION SCOPE AND RECURSION EDGE CASES: function return in subshell' |
| 277 | steps: |
| 278 | - send_line: f() { (return 5); echo $?; }; f |
| 279 | expect_output: '5' |
| 280 | match_type: contains |
| 281 | - name: '100. FUNCTION SCOPE AND RECURSION EDGE CASES: recursive factorial' |
| 282 | steps: |
| 283 | - send_line: fact() { if [ $1 -le 1 ]; then echo 1; else local r=$(fact $(($1-1)) |
| 284 | 2>/dev/null || fact $(($1-1))); echo $(($1 * r)); fi; }; fact 4 |
| 285 | expect_output: '24' |
| 286 | match_type: contains |
| 287 | auto_fixed: shell_execution |
| 288 | - name: '101. EXIT STATUS IN COMPOUND COMMANDS: subshell exit status (exit code)' |
| 289 | steps: |
| 290 | - send_line: (exit 42); echo $? |
| 291 | - send_line: echo "EXIT=$?" |
| 292 | expect_output: EXIT=0 |
| 293 | match_type: contains |
| 294 | - name: '101. EXIT STATUS IN COMPOUND COMMANDS: brace group exit status (exit code)' |
| 295 | steps: |
| 296 | - send_line: '{ false; }; echo $?' |
| 297 | - send_line: echo "EXIT=$?" |
| 298 | expect_output: EXIT=0 |
| 299 | match_type: contains |
| 300 | - name: '101. EXIT STATUS IN COMPOUND COMMANDS: if statement exit status (exit code)' |
| 301 | steps: |
| 302 | - send_line: if true; then true; fi; echo $? |
| 303 | - send_line: echo "EXIT=$?" |
| 304 | expect_output: EXIT=0 |
| 305 | match_type: contains |
| 306 | - name: '101. EXIT STATUS IN COMPOUND COMMANDS: for loop exit status (exit code)' |
| 307 | steps: |
| 308 | - send_line: for i in 1; do false; done; echo $? |
| 309 | - send_line: echo "EXIT=$?" |
| 310 | expect_output: EXIT=0 |
| 311 | match_type: contains |
| 312 | - name: '101. EXIT STATUS IN COMPOUND COMMANDS: while loop exit status (exit code)' |
| 313 | steps: |
| 314 | - send_line: while false; do :; done; echo $? |
| 315 | - send_line: echo "EXIT=$?" |
| 316 | expect_output: EXIT=0 |
| 317 | match_type: contains |
| 318 | - name: '101. EXIT STATUS IN COMPOUND COMMANDS: case exit status (exit code)' |
| 319 | steps: |
| 320 | - send_line: case x in x) false;; esac; echo $? |
| 321 | - send_line: echo "EXIT=$?" |
| 322 | expect_output: EXIT=0 |
| 323 | match_type: contains |
| 324 | - name: '102. SET BUILTIN EDGE CASES: set -- clears positionals' |
| 325 | steps: |
| 326 | - send_line: set -- a b; set --; echo $# |
| 327 | expect_output: '0' |
| 328 | match_type: contains |
| 329 | - name: '102. SET BUILTIN EDGE CASES: set -- with empty' |
| 330 | steps: |
| 331 | - send_line: set -- ''; echo $# |$1| |
| 332 | expect_output: 1 || |
| 333 | match_type: contains |
| 334 | auto_fixed: manual_determination |
| 335 | - name: '102. SET BUILTIN EDGE CASES: set -- with spaces' |
| 336 | steps: |
| 337 | - send_line: set -- 'a b' 'c d'; echo $1 |
| 338 | expect_output: '''a' |
| 339 | match_type: contains |
| 340 | auto_fixed: shell_execution |
| 341 | - name: '102. SET BUILTIN EDGE CASES: set without args shows vars' |
| 342 | steps: |
| 343 | - send_line: X=1; set | grep -c '^X=' |
| 344 | expect_output: '[0-9]+' |
| 345 | match_type: regex |
| 346 | - name: '102. SET BUILTIN EDGE CASES: set -o lists options' |
| 347 | steps: |
| 348 | - send_line: set -o 2>&1 | wc -l |
| 349 | expect_output: '[0-9]+' |
| 350 | match_type: regex |
| 351 | - name: '103. SHIFT EDGE CASES: shift with count' |
| 352 | steps: |
| 353 | - send_line: set -- a b c d e; shift 3; echo $1 |
| 354 | expect_output: 'd' |
| 355 | match_type: contains |
| 356 | - name: '103. SHIFT EDGE CASES: shift too many (exit code)' |
| 357 | steps: |
| 358 | - send_line: set -- a b; shift 5 2>/dev/null |
| 359 | - send_line: echo "EXIT=$?" |
| 360 | expect_output: EXIT=1 |
| 361 | match_type: contains |
| 362 | - name: '103. SHIFT EDGE CASES: shift zero' |
| 363 | steps: |
| 364 | - send_line: set -- a b c; shift 0; echo $# |
| 365 | expect_output: '3' |
| 366 | match_type: contains |
| 367 | - name: '103. SHIFT EDGE CASES: shift all' |
| 368 | steps: |
| 369 | - send_line: set -- a b c; shift 3; echo $# |
| 370 | expect_output: '0' |
| 371 | match_type: contains |
| 372 | - name: '103. SHIFT EDGE CASES: shift with no args (exit code)' |
| 373 | steps: |
| 374 | - send_line: set --; shift 2>/dev/null |
| 375 | - send_line: echo "EXIT=$?" |
| 376 | expect_output: EXIT=1 |
| 377 | match_type: contains |
| 378 | - name: '104. EVAL EDGE CASES: eval with semicolons' |
| 379 | steps: |
| 380 | - send_line: eval 'echo a; echo b' | wc -l |
| 381 | expect_output: '2' |
| 382 | match_type: contains |
| 383 | - name: '104. EVAL EDGE CASES: eval with pipes' |
| 384 | steps: |
| 385 | - send_line: eval 'echo test | cat' |
| 386 | expect_output: test |
| 387 | match_type: contains |
| 388 | auto_fixed: shell_execution |
| 389 | - name: '104. EVAL EDGE CASES: eval with redirects' |
| 390 | steps: |
| 391 | - send_line: eval 'echo test > /tmp/posix_gaps_eval_$$'; cat /tmp/posix_gaps_eval_$$; |
| 392 | rm -f /tmp/posix_gaps_eval_$$ |
| 393 | expect_output: test |
| 394 | match_type: contains |
| 395 | auto_fixed: shell_execution |
| 396 | - name: '104. EVAL EDGE CASES: eval double expansion' |
| 397 | steps: |
| 398 | - send_line: VAR='echo $HOME'; eval $VAR | grep -c / |
| 399 | expect_output: '[0-9]+' |
| 400 | match_type: regex |
| 401 | - name: '104. EVAL EDGE CASES: eval empty string' |
| 402 | steps: |
| 403 | - send_line: eval ''; echo ok |
| 404 | expect_output: ok |
| 405 | match_type: contains |
| 406 | - name: '104. EVAL EDGE CASES: nested eval' |
| 407 | steps: |
| 408 | - send_line: eval eval echo nested |
| 409 | expect_output: nested |
| 410 | match_type: contains |
| 411 | auto_fixed: shell_execution |
| 412 | - name: '105. READONLY AND UNSET INTERACTIONS: readonly then unset fails (exit code)' |
| 413 | steps: |
| 414 | - send_line: readonly X=1; unset X 2>/dev/null |
| 415 | - send_line: echo "EXIT=$?" |
| 416 | expect_output: EXIT=1 |
| 417 | match_type: contains |
| 418 | - name: '105. READONLY AND UNSET INTERACTIONS: export readonly (exit code)' |
| 419 | steps: |
| 420 | - send_line: readonly XP=1; export XP; sh -c 'echo $XP' | grep -c 1 |
| 421 | - send_line: echo "EXIT=$?" |
| 422 | expect_output: EXIT=0 |
| 423 | match_type: contains |
| 424 | - name: '105. READONLY AND UNSET INTERACTIONS: readonly in subshell' |
| 425 | steps: |
| 426 | - send_line: (readonly Y=2; echo $Y); readonly | grep -c Y || echo 0 |
| 427 | expect_output: '[0-9]+' |
| 428 | match_type: regex |
| 429 | - name: '106. RETURN BUILTIN EDGE CASES: return without function' |
| 430 | steps: |
| 431 | - send_line: return 2>/dev/null || echo ok |
| 432 | expect_output: ok |
| 433 | match_type: contains |
| 434 | auto_fixed: shell_execution |
| 435 | - name: '106. RETURN BUILTIN EDGE CASES: return value preserved' |
| 436 | steps: |
| 437 | - send_line: f() { return 42; }; f; echo $? |
| 438 | expect_output: '42' |
| 439 | match_type: contains |
| 440 | - name: '106. RETURN BUILTIN EDGE CASES: return in sourced script' |
| 441 | steps: |
| 442 | - send_line: echo 'return 7' > /tmp/posix_gaps_source_$$; . /tmp/posix_gaps_source_$$ |
| 443 | 2>/dev/null || echo $?; rm -f /tmp/posix_gaps_source_$$ |
| 444 | expect_output: '7' |
| 445 | match_type: contains |
| 446 | - name: '107. DOT (.) BUILTIN EDGE CASES: source with PATH search' |
| 447 | steps: |
| 448 | - send_line: echo 'echo sourced' > /tmp/posix_gaps_dot_$$; PATH=/tmp:$PATH; . posix_gaps_dot_$$ |
| 449 | 2>/dev/null || echo 'not found'; rm -f /tmp/posix_gaps_dot_$$ |
| 450 | expect_output: sourced |
| 451 | match_type: contains |
| 452 | auto_fixed: shell_execution |
| 453 | - name: '107. DOT (.) BUILTIN EDGE CASES: source nonexistent (exit code)' |
| 454 | steps: |
| 455 | - send_line: . /tmp/posix_gaps_nonexistent_$$ 2>/dev/null |
| 456 | - send_line: echo "EXIT=$?" |
| 457 | expect_output: EXIT=1 |
| 458 | match_type: contains |
| 459 | - name: '107. DOT (.) BUILTIN EDGE CASES: source preserves variables' |
| 460 | steps: |
| 461 | - send_line: echo 'A=from_source' > /tmp/posix_gaps_dot2_$$; . /tmp/posix_gaps_dot2_$$; |
| 462 | echo $A; rm -f /tmp/posix_gaps_dot2_$$ |
| 463 | expect_output: from_source |
| 464 | match_type: contains |
| 465 | - name: '108. BREAK AND CONTINUE EDGE CASES: break with level 0' |
| 466 | steps: |
| 467 | - send_line: for i in 1 2; do break 0 2>/dev/null || break; echo $i; done || echo |
| 468 | ok |
| 469 | expect_output: ok |
| 470 | match_type: contains |
| 471 | auto_fixed: shell_execution |
| 472 | - name: '108. BREAK AND CONTINUE EDGE CASES: break level too high' |
| 473 | steps: |
| 474 | - send_line: for i in 1 2; do break 10 2>/dev/null || break; echo $i; done || echo |
| 475 | done |
| 476 | expect_output: '' |
| 477 | match_type: exact |
| 478 | - name: '108. BREAK AND CONTINUE EDGE CASES: continue with level' |
| 479 | steps: |
| 480 | - send_line: for i in 1 2; do for j in a b; do continue 2 2>/dev/null || continue; |
| 481 | echo $i$j; done; done || echo ok |
| 482 | expect_output: '' |
| 483 | match_type: exact |
| 484 | - name: '108. BREAK AND CONTINUE EDGE CASES: break outside loop' |
| 485 | steps: |
| 486 | - send_line: break 2>/dev/null || echo ok |
| 487 | expect_output: ok |
| 488 | match_type: contains |
| 489 | auto_fixed: manual_determination |
| 490 | - name: '108. BREAK AND CONTINUE EDGE CASES: continue outside loop' |
| 491 | steps: |
| 492 | - send_line: continue 2>/dev/null || echo ok |
| 493 | expect_output: ok |
| 494 | match_type: contains |
| 495 | auto_fixed: manual_determination |
| 496 | - name: '109. CASE STATEMENT EDGE CASES: case empty pattern' |
| 497 | steps: |
| 498 | - send_line: x=''; case $x in '') echo empty;; esac |
| 499 | expect_output: empty |
| 500 | match_type: contains |
| 501 | auto_fixed: shell_execution |
| 502 | - name: '109. CASE STATEMENT EDGE CASES: case no match' |
| 503 | steps: |
| 504 | - send_line: x=z; case $x in a) echo a;; b) echo b;; esac; echo ok |
| 505 | expect_output: ok |
| 506 | match_type: contains |
| 507 | - name: '109. CASE STATEMENT EDGE CASES: case with quotes' |
| 508 | steps: |
| 509 | - send_line: x='a b'; case $x in 'a b') echo match;; esac |
| 510 | expect_output: match |
| 511 | match_type: contains |
| 512 | auto_fixed: shell_execution |
| 513 | - name: '109. CASE STATEMENT EDGE CASES: case glob vs literal' |
| 514 | steps: |
| 515 | - send_line: x='*'; case $x in '*') echo literal;; esac |
| 516 | expect_output: literal |
| 517 | match_type: contains |
| 518 | auto_fixed: shell_execution |
| 519 | - name: '109. CASE STATEMENT EDGE CASES: case bracket range' |
| 520 | steps: |
| 521 | - send_line: x=b; case $x in [a-c]) echo range;; esac |
| 522 | expect_output: range |
| 523 | match_type: contains |
| 524 | auto_fixed: shell_execution |
| 525 | - name: '109. CASE STATEMENT EDGE CASES: case multiple patterns order' |
| 526 | steps: |
| 527 | - send_line: x=a; case $x in a|b) echo first;; a) echo second;; esac |
| 528 | expect_output: first |
| 529 | match_type: contains |
| 530 | auto_fixed: shell_execution |
| 531 | - name: '109. CASE STATEMENT EDGE CASES: case with variable pattern' |
| 532 | steps: |
| 533 | - send_line: P='a*'; x=abc; case $x in $P) echo var_pattern;; esac |
| 534 | expect_output: var_pattern |
| 535 | match_type: contains |
| 536 | auto_fixed: shell_execution |
| 537 | - name: '110. FOR LOOP EDGE CASES: for empty word list' |
| 538 | steps: |
| 539 | - send_line: for i in; do echo $i; done; echo empty |
| 540 | expect_output: empty |
| 541 | match_type: contains |
| 542 | - name: '110. FOR LOOP EDGE CASES: for single item' |
| 543 | steps: |
| 544 | - send_line: for i in one; do echo $i; done |
| 545 | expect_output: one |
| 546 | match_type: contains |
| 547 | - name: '110. FOR LOOP EDGE CASES: for with glob expansion' |
| 548 | steps: |
| 549 | - send_line: touch /tmp/posix_gaps_for{1,2,3}_$$.txt 2>/dev/null; for f in /tmp/posix_gaps_for*_$$.txt; |
| 550 | do test -f $f && echo yes; done | head -1; rm -f /tmp/posix_gaps_for*_$$.txt |
| 551 | expect_output: 'yes' |
| 552 | match_type: contains |
| 553 | auto_fixed: shell_execution |
| 554 | - name: '110. FOR LOOP EDGE CASES: for preserves IFS' |
| 555 | steps: |
| 556 | - send_line: IFS=:; for i in a b c; do echo $i; done; echo $IFS | od -A n -t x1 |
| 557 | | grep -c 3a |
| 558 | expect_output: '1' |
| 559 | match_type: contains |
| 560 | auto_fixed: manual_determination |
| 561 | - name: '111. WHILE AND UNTIL EDGE CASES: while true with break' |
| 562 | steps: |
| 563 | - send_line: i=0; while true; do i=$((i+1)); test $i -eq 3 && break; done; echo |
| 564 | $i |
| 565 | expect_output: '3' |
| 566 | match_type: contains |
| 567 | auto_fixed: shell_execution |
| 568 | - name: '111. WHILE AND UNTIL EDGE CASES: until false with break' |
| 569 | steps: |
| 570 | - send_line: i=0; until false; do i=$((i+1)); test $i -eq 3 && break; done; echo |
| 571 | $i |
| 572 | expect_output: '3' |
| 573 | match_type: contains |
| 574 | auto_fixed: shell_execution |
| 575 | - name: '111. WHILE AND UNTIL EDGE CASES: while with exit status' |
| 576 | steps: |
| 577 | - send_line: i=5; while [ $i -gt 0 ]; do i=$((i-1)); done; echo $? |
| 578 | expect_output: '0' |
| 579 | match_type: contains |
| 580 | auto_fixed: shell_execution |
| 581 | - name: '111. WHILE AND UNTIL EDGE CASES: until with complex condition' |
| 582 | steps: |
| 583 | - send_line: i=0; until [ $i -gt 3 ] && [ $i -lt 10 ]; do i=$((i+1)); done; echo |
| 584 | $i |
| 585 | expect_output: '4' |
| 586 | match_type: contains |
| 587 | auto_fixed: shell_execution |
| 588 | - name: '112. SUBSHELL VARIABLE ISOLATION: subshell doesnt modify parent' |
| 589 | steps: |
| 590 | - send_line: (X=inner); echo ${X:-unset} |
| 591 | expect_output: unset |
| 592 | match_type: contains |
| 593 | - name: '112. SUBSHELL VARIABLE ISOLATION: subshell inherits variables' |
| 594 | steps: |
| 595 | - send_line: X=outer; (echo $X) |
| 596 | expect_output: outer |
| 597 | match_type: contains |
| 598 | - name: '112. SUBSHELL VARIABLE ISOLATION: nested subshells' |
| 599 | steps: |
| 600 | - send_line: X=1; (X=2; (X=3; echo $X); echo $X); echo $X |
| 601 | expect_output: '3' |
| 602 | match_type: contains |
| 603 | - name: '112. SUBSHELL VARIABLE ISOLATION: subshell with exports' |
| 604 | steps: |
| 605 | - send_line: export X=exp; (X=inner; echo $X); echo $X |
| 606 | expect_output: inner |
| 607 | match_type: contains |
| 608 | - name: '113. BRACE GROUP SCOPING: brace group modifies parent' |
| 609 | steps: |
| 610 | - send_line: X=1; { X=2; }; echo $X |
| 611 | expect_output: '2' |
| 612 | match_type: contains |
| 613 | - name: '113. BRACE GROUP SCOPING: brace group with redirects' |
| 614 | steps: |
| 615 | - send_line: '{ echo a; echo b; } | wc -l' |
| 616 | expect_output: '[0-9]+' |
| 617 | match_type: regex |
| 618 | - name: '113. BRACE GROUP SCOPING: nested brace groups' |
| 619 | steps: |
| 620 | - send_line: X=1; { { X=2; }; echo $X; }; echo $X |
| 621 | expect_output: '2' |
| 622 | match_type: contains |
| 623 | - name: '114. ALIAS EDGE CASES: alias with args' |
| 624 | steps: |
| 625 | - send_line: alias ll='ls -l'; alias ll | grep -c 'ls -l' |
| 626 | expect_output: '[0-9]+' |
| 627 | match_type: regex |
| 628 | - name: '114. ALIAS EDGE CASES: alias recursive prevention' |
| 629 | steps: |
| 630 | - send_line: alias ls='ls -a'; command ls /tmp >/dev/null; echo $? |
| 631 | expect_output: '0' |
| 632 | match_type: contains |
| 633 | - name: '114. ALIAS EDGE CASES: unalias nonexistent' |
| 634 | steps: |
| 635 | - send_line: unalias nonexistent_alias_$$ 2>/dev/null || echo ok |
| 636 | expect_output: ok |
| 637 | match_type: contains |
| 638 | auto_fixed: shell_execution |
| 639 | - name: '114. ALIAS EDGE CASES: alias name same as builtin' |
| 640 | steps: |
| 641 | - send_line: alias echo='printf'; unalias echo; command -v echo | grep -c echo |
| 642 | expect_output: '[0-9]+' |
| 643 | match_type: regex |
| 644 | - name: '115. TEST COMMAND COMPLEX EXPRESSIONS: test complex AND/OR (exit code)' |
| 645 | steps: |
| 646 | - send_line: test 5 -gt 3 -a \( 10 -lt 20 -o 1 -eq 2 \) |
| 647 | - send_line: echo "EXIT=$?" |
| 648 | expect_output: EXIT=0 |
| 649 | match_type: contains |
| 650 | - name: '115. TEST COMMAND COMPLEX EXPRESSIONS: test negation precedence (exit code)' |
| 651 | steps: |
| 652 | - send_line: test ! 5 -gt 10 |
| 653 | - send_line: echo "EXIT=$?" |
| 654 | expect_output: EXIT=0 |
| 655 | match_type: contains |
| 656 | - name: '115. TEST COMMAND COMPLEX EXPRESSIONS: test string empty (exit code)' |
| 657 | steps: |
| 658 | - send_line: test -z '' |
| 659 | - send_line: echo "EXIT=$?" |
| 660 | expect_output: EXIT=0 |
| 661 | match_type: contains |
| 662 | - name: '115. TEST COMMAND COMPLEX EXPRESSIONS: test string nonempty (exit code)' |
| 663 | steps: |
| 664 | - send_line: test -n 'x' |
| 665 | - send_line: echo "EXIT=$?" |
| 666 | expect_output: EXIT=0 |
| 667 | match_type: contains |
| 668 | - name: '115. TEST COMMAND COMPLEX EXPRESSIONS: test string unary (exit code)' |
| 669 | steps: |
| 670 | - send_line: test 'nonempty' |
| 671 | - send_line: echo "EXIT=$?" |
| 672 | expect_output: EXIT=0 |
| 673 | match_type: contains |
| 674 | - name: '116. SPECIAL PARAMETER EDGE CASES: \$@ with IFS' |
| 675 | steps: |
| 676 | - send_line: 'IFS=:; set -- a b c; echo "$@"' |
| 677 | expect_output: 'a b c' |
| 678 | match_type: contains |
| 679 | - name: '116. SPECIAL PARAMETER EDGE CASES: \$* vs \$@ unquoted' |
| 680 | steps: |
| 681 | - send_line: set -- a b c; for x in $*; do echo $x; done | wc -l |
| 682 | expect_output: '[0-9]+' |
| 683 | match_type: regex |
| 684 | - name: '116. SPECIAL PARAMETER EDGE CASES: \$@ quoted iteration' |
| 685 | steps: |
| 686 | - send_line: 'set -- "a b" "c d"; for x in "$@"; do echo "$x"; done | wc -l' |
| 687 | expect_output: '2' |
| 688 | match_type: contains |
| 689 | - name: '116. SPECIAL PARAMETER EDGE CASES: \$# after shift' |
| 690 | steps: |
| 691 | - send_line: set -- a b c; shift; echo $# |
| 692 | expect_output: '2' |
| 693 | match_type: contains |
| 694 | - name: '116. SPECIAL PARAMETER EDGE CASES: \$- shows options' |
| 695 | steps: |
| 696 | - send_line: echo $- | grep -c '[a-z]' |
| 697 | expect_output: '1' |
| 698 | match_type: contains |
| 699 | auto_fixed: shell_execution |
| 700 | - name: '116. SPECIAL PARAMETER EDGE CASES: \$\$ is numeric' |
| 701 | steps: |
| 702 | - send_line: echo $$ | grep -c '^[0-9]*$' |
| 703 | expect_output: '1' |
| 704 | match_type: contains |
| 705 | auto_fixed: shell_execution |
| 706 | - name: '116. SPECIAL PARAMETER EDGE CASES: \$! after background' |
| 707 | steps: |
| 708 | - send_line: sleep 0.1 & echo $! | grep -c '^[0-9]*$' |
| 709 | expect_output: '[0-9]+' |
| 710 | match_type: regex |
| 711 | - name: '117. TILDE EXPANSION EDGE CASES: tilde in assignment' |
| 712 | steps: |
| 713 | - send_line: VAR=~/test; echo $VAR | grep -c '^/' |
| 714 | expect_output: '1' |
| 715 | match_type: contains |
| 716 | - name: '117. TILDE EXPANSION EDGE CASES: tilde in middle no expand' |
| 717 | steps: |
| 718 | - send_line: echo a~b | grep -c '~' |
| 719 | expect_output: '1' |
| 720 | match_type: contains |
| 721 | - name: '117. TILDE EXPANSION EDGE CASES: tilde in quotes no expand' |
| 722 | steps: |
| 723 | - send_line: echo '~' | grep -c '~' |
| 724 | expect_output: '1' |
| 725 | match_type: contains |
| 726 | - name: '118. COMMAND SUBSTITUTION EDGE CASES: command subst nested' |
| 727 | steps: |
| 728 | - send_line: echo $(echo $(echo nested)) |
| 729 | expect_output: nested |
| 730 | match_type: contains |
| 731 | auto_fixed: shell_execution |
| 732 | - name: '118. COMMAND SUBSTITUTION EDGE CASES: command subst with pipes' |
| 733 | steps: |
| 734 | - send_line: echo $(echo a | cat) |
| 735 | expect_output: a |
| 736 | match_type: contains |
| 737 | auto_fixed: shell_execution |
| 738 | - name: '118. COMMAND SUBSTITUTION EDGE CASES: command subst multiline' |
| 739 | steps: |
| 740 | - send_line: 'result=$(echo a; echo b); echo "$result"' |
| 741 | expect_output: 'a' |
| 742 | match_type: contains |
| 743 | - name: '118. COMMAND SUBSTITUTION EDGE CASES: command subst empty' |
| 744 | steps: |
| 745 | - send_line: 'x=$(true); echo "len=${#x}"' |
| 746 | expect_output: 'len=0' |
| 747 | match_type: contains |
| 748 | - name: '118. COMMAND SUBSTITUTION EDGE CASES: backtick vs dollar-paren' |
| 749 | steps: |
| 750 | - send_line: 'a=`echo test`; b=$(echo test); test "$a" = "$b" && echo same' |
| 751 | expect_output: 'same' |
| 752 | match_type: contains |
| 753 | - name: '119. REDIRECT EDGE CASES: redirect order matters' |
| 754 | steps: |
| 755 | - send_line: echo test 2>&1 >/dev/null | wc -l |
| 756 | expect_output: '0' |
| 757 | match_type: contains |
| 758 | - name: '119. REDIRECT EDGE CASES: redirect to same fd' |
| 759 | steps: |
| 760 | - send_line: echo test >&1 2>&1 |
| 761 | expect_output: test |
| 762 | match_type: contains |
| 763 | - name: '119. REDIRECT EDGE CASES: redirect append' |
| 764 | steps: |
| 765 | - send_line: echo a > /tmp/posix_gaps_redir_$$; echo b >> /tmp/posix_gaps_redir_$$; |
| 766 | wc -l < /tmp/posix_gaps_redir_$$; rm -f /tmp/posix_gaps_redir_$$ |
| 767 | expect_output: '2' |
| 768 | match_type: contains |
| 769 | auto_fixed: shell_execution |
| 770 | - name: '120. WAIT BUILTIN EDGE CASES: wait for background job (exit code)' |
| 771 | steps: |
| 772 | - send_line: '(sleep 0.01 & pid=$!; wait $pid; echo EXIT=$?)' |
| 773 | expect_output: EXIT=0 |
| 774 | match_type: contains |
| 775 | - name: '120. WAIT BUILTIN EDGE CASES: wait all jobs (exit code)' |
| 776 | steps: |
| 777 | - send_line: '(sleep 0.01 & sleep 0.01 & wait; echo EXIT=$?)' |
| 778 | expect_output: EXIT=0 |
| 779 | match_type: contains |
| 780 | - name: '120. WAIT BUILTIN EDGE CASES: wait nonexistent PID (exit code)' |
| 781 | steps: |
| 782 | - send_line: wait 9999999 2>/dev/null |
| 783 | - send_line: echo "EXIT=$?" |
| 784 | expect_output: EXIT=127 |
| 785 | match_type: contains |
| 786 | - name: '120. WAIT BUILTIN EDGE CASES: wait preserves exit status' |
| 787 | steps: |
| 788 | - send_line: sh -c 'exit 42' & pid=$!; wait $pid; echo $? |
| 789 | expect_output: '42' |
| 790 | match_type: contains |
| 791 | - name: '121. GETOPTS COMPREHENSIVE: getopts basic' |
| 792 | steps: |
| 793 | - send_line: set -- -a test; getopts 'a:' opt; echo $opt |
| 794 | expect_output: 'a' |
| 795 | match_type: contains |
| 796 | - name: '121. GETOPTS COMPREHENSIVE: getopts OPTARG' |
| 797 | steps: |
| 798 | - send_line: set -- -a value; getopts 'a:' opt; echo $OPTARG |
| 799 | expect_output: 'value' |
| 800 | match_type: contains |
| 801 | - name: '121. GETOPTS COMPREHENSIVE: getopts OPTIND' |
| 802 | steps: |
| 803 | - send_line: set -- -a -b; getopts 'ab' opt; echo $OPTIND |
| 804 | expect_output: '2' |
| 805 | match_type: contains |
| 806 | - name: '121. GETOPTS COMPREHENSIVE: getopts invalid option' |
| 807 | steps: |
| 808 | - send_line: set -- -z; getopts 'ab' opt 2>/dev/null; echo $opt | grep -c '?' |
| 809 | expect_output: '1' |
| 810 | match_type: contains |
| 811 | auto_fixed: shell_execution |
| 812 | - name: '122. UMASK EDGE CASES: umask get' |
| 813 | steps: |
| 814 | - send_line: umask | grep -c '^[0-9]*$' |
| 815 | expect_output: '[0-9]+' |
| 816 | match_type: regex |
| 817 | - name: '122. UMASK EDGE CASES: umask set and get' |
| 818 | steps: |
| 819 | - send_line: old=$(umask); umask 022; umask; umask $old | head -1 |
| 820 | expect_output: '0022' |
| 821 | match_type: contains |
| 822 | auto_fixed: shell_execution |
| 823 | - name: '123. HASH BUILTIN EDGE CASES: hash command (exit code)' |
| 824 | steps: |
| 825 | - send_line: hash echo 2>/dev/null |
| 826 | - send_line: echo "EXIT=$?" |
| 827 | expect_output: EXIT=0 |
| 828 | match_type: contains |
| 829 | - name: '123. HASH BUILTIN EDGE CASES: hash -r clears (exit code)' |
| 830 | steps: |
| 831 | - send_line: hash -r |
| 832 | - send_line: echo "EXIT=$?" |
| 833 | expect_output: EXIT=0 |
| 834 | match_type: contains |
| 835 | - name: '123. HASH BUILTIN EDGE CASES: hash nonexistent' |
| 836 | steps: |
| 837 | - send_line: hash nonexistent_cmd_$$ 2>&1 | grep -c 'not found\\|hash' |
| 838 | expect_output: '[0-9]+' |
| 839 | match_type: regex |
| 840 | - name: '124. TYPE BUILTIN EDGE CASES: type builtin' |
| 841 | steps: |
| 842 | - send_line: type echo | grep -ci 'builtin\\|built-in\\|shell builtin' |
| 843 | expect_output: '[0-9]+' |
| 844 | match_type: regex |
| 845 | - name: '124. TYPE BUILTIN EDGE CASES: type function' |
| 846 | steps: |
| 847 | - send_line: f() { :; }; type f | grep -c function |
| 848 | expect_output: '[0-9]+' |
| 849 | match_type: regex |
| 850 | - name: '124. TYPE BUILTIN EDGE CASES: type external' |
| 851 | steps: |
| 852 | - send_line: type cat | grep -c '/' |
| 853 | expect_output: '[0-9]+' |
| 854 | match_type: regex |
| 855 | - name: '124. TYPE BUILTIN EDGE CASES: type nonexistent (exit code)' |
| 856 | steps: |
| 857 | - send_line: type nonexistent_$$ 2>/dev/null |
| 858 | - send_line: echo "EXIT=$?" |
| 859 | expect_output: EXIT=1 |
| 860 | match_type: contains |
| 861 | - name: '125. TIMES BUILTIN: times output format' |
| 862 | steps: |
| 863 | - send_line: times | wc -l |
| 864 | expect_output: '[0-9]+' |
| 865 | match_type: regex |
| 866 | - name: '125. TIMES BUILTIN: times exit status (exit code)' |
| 867 | steps: |
| 868 | - send_line: times >/dev/null |
| 869 | - send_line: echo "EXIT=$?" |
| 870 | expect_output: EXIT=0 |
| 871 | match_type: contains |
| 872 | - name: '126. TRAP SIGNAL EDGE CASES: trap with signal number' |
| 873 | steps: |
| 874 | - send_line: trap 'echo sig' 15; trap | grep -c 15 |
| 875 | expect_output: '[0-9]+' |
| 876 | match_type: regex |
| 877 | - name: '126. TRAP SIGNAL EDGE CASES: trap with multiple signals' |
| 878 | steps: |
| 879 | - send_line: trap 'echo multi' INT TERM; trap | grep -c 'echo multi' |
| 880 | expect_output: '[0-9]+' |
| 881 | match_type: regex |
| 882 | - name: '126. TRAP SIGNAL EDGE CASES: trap ignore signal' |
| 883 | steps: |
| 884 | - send_line: trap '' INT; trap | grep INT | grep -c '' |
| 885 | expect_output: '[0-9]+' |
| 886 | match_type: regex |
| 887 | - name: '127. EMPTY AND WHITESPACE EDGE CASES: empty command in list' |
| 888 | steps: |
| 889 | - send_line: ': ; echo ok' |
| 890 | expect_output: ok |
| 891 | match_type: contains |
| 892 | - name: '127. EMPTY AND WHITESPACE EDGE CASES: whitespace only' |
| 893 | steps: |
| 894 | - send_line: ' ; echo ok' |
| 895 | expect_output: ok |
| 896 | match_type: contains |
| 897 | - name: '127. EMPTY AND WHITESPACE EDGE CASES: multiple empty commands' |
| 898 | steps: |
| 899 | - send_line: ': ; : ; echo ok' |
| 900 | expect_output: ok |
| 901 | match_type: contains |
| 902 | - name: '127. EMPTY AND WHITESPACE EDGE CASES: empty string as command' |
| 903 | steps: |
| 904 | - send_line: ''''' 2>/dev/null || echo ok' |
| 905 | expect_output: ok |
| 906 | match_type: contains |
| 907 | auto_fixed: shell_execution |
| 908 | - name: '128. COMPLEX PIPELINES: five stage pipeline' |
| 909 | steps: |
| 910 | - send_line: echo test | cat | cat | cat | cat |
| 911 | expect_output: test |
| 912 | match_type: contains |
| 913 | - name: '128. COMPLEX PIPELINES: pipeline with negation (exit code)' |
| 914 | steps: |
| 915 | - send_line: '! false | false' |
| 916 | - send_line: echo "EXIT=$?" |
| 917 | expect_output: EXIT=0 |
| 918 | match_type: contains |
| 919 | - name: '128. COMPLEX PIPELINES: pipeline with subshell' |
| 920 | steps: |
| 921 | - send_line: (echo a; echo b) | wc -l |
| 922 | expect_output: '2' |
| 923 | match_type: contains |
| 924 | - name: '128. COMPLEX PIPELINES: pipeline with brace group' |
| 925 | steps: |
| 926 | - send_line: '{ echo x; echo y; } | wc -l' |
| 927 | expect_output: '[0-9]+' |
| 928 | match_type: regex |
| 929 | - name: '129. EXIT BUILTIN EDGE CASES: exit with status (exit code)' |
| 930 | steps: |
| 931 | - send_line: sh -c 'exit 42' |
| 932 | - send_line: echo "EXIT=$?" |
| 933 | expect_output: EXIT=42 |
| 934 | match_type: contains |
| 935 | - name: '129. EXIT BUILTIN EDGE CASES: exit in subshell (exit code)' |
| 936 | steps: |
| 937 | - send_line: (exit 7); echo $? |
| 938 | - send_line: echo "EXIT=$?" |
| 939 | expect_output: EXIT=0 |
| 940 | match_type: contains |
| 941 | - name: '130. EXPORT EDGE CASES: export without value' |
| 942 | steps: |
| 943 | - send_line: export VAR; sh -c 'echo ${VAR:-unset}' |
| 944 | expect_output: unset |
| 945 | match_type: contains |
| 946 | - name: '130. EXPORT EDGE CASES: export with value' |
| 947 | steps: |
| 948 | - send_line: export VAR=value; sh -c 'echo $VAR' |
| 949 | expect_output: value |
| 950 | match_type: contains |
| 951 | - name: '130. EXPORT EDGE CASES: export multiple' |
| 952 | steps: |
| 953 | - send_line: export A=1 B=2; sh -c 'echo $A $B' |
| 954 | expect_output: 1 2 |
| 955 | match_type: contains |
| 956 | - name: '130. EXPORT EDGE CASES: export readonly' |
| 957 | steps: |
| 958 | - send_line: readonly XR=ro; export XR; sh -c 'echo $XR' |
| 959 | expect_output: ro |
| 960 | match_type: contains |
| 961 |