| 1 | metadata: |
| 2 | category: Extended |
| 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: '26. EXTENDED TEST COMMAND - FILE TYPE TESTS: test -e exists (exit code)' |
| 8 | steps: |
| 9 | - send_line: test -e /tmp/posix_test_regular |
| 10 | - send_line: echo "EXIT=$?" |
| 11 | expect_output: EXIT=1 |
| 12 | match_type: contains |
| 13 | - name: '26. EXTENDED TEST COMMAND - FILE TYPE TESTS: test -e nonexistent (exit code)' |
| 14 | steps: |
| 15 | - send_line: '! test -e /tmp/nonexistent_xyz_$$' |
| 16 | - send_line: echo "EXIT=$?" |
| 17 | expect_output: EXIT=0 |
| 18 | match_type: contains |
| 19 | - name: '26. EXTENDED TEST COMMAND - FILE TYPE TESTS: test -f regular file (exit code)' |
| 20 | steps: |
| 21 | - send_line: test -f /tmp/posix_test_regular |
| 22 | - send_line: echo "EXIT=$?" |
| 23 | expect_output: EXIT=1 |
| 24 | match_type: contains |
| 25 | - name: '26. EXTENDED TEST COMMAND - FILE TYPE TESTS: test -d directory (exit code)' |
| 26 | steps: |
| 27 | - send_line: test -d /tmp |
| 28 | - send_line: echo "EXIT=$?" |
| 29 | expect_output: EXIT=0 |
| 30 | match_type: contains |
| 31 | - name: '26. EXTENDED TEST COMMAND - FILE TYPE TESTS: test -s non-empty (exit code)' |
| 32 | steps: |
| 33 | - send_line: test -s /tmp/posix_test_nonempty |
| 34 | - send_line: echo "EXIT=$?" |
| 35 | expect_output: EXIT=1 |
| 36 | match_type: contains |
| 37 | - name: '26. EXTENDED TEST COMMAND - FILE TYPE TESTS: test -s empty (exit code)' |
| 38 | steps: |
| 39 | - send_line: '! test -s /tmp/posix_test_regular' |
| 40 | - send_line: echo "EXIT=$?" |
| 41 | expect_output: EXIT=0 |
| 42 | match_type: contains |
| 43 | - name: '26. EXTENDED TEST COMMAND - FILE TYPE TESTS: test -L symlink (exit code)' |
| 44 | steps: |
| 45 | - send_line: test -L /tmp/posix_test_symlink |
| 46 | - send_line: echo "EXIT=$?" |
| 47 | expect_output: EXIT=1 |
| 48 | match_type: contains |
| 49 | - name: '26. EXTENDED TEST COMMAND - FILE TYPE TESTS: test -h symlink (exit code)' |
| 50 | steps: |
| 51 | - send_line: test -h /tmp/posix_test_symlink |
| 52 | - send_line: echo "EXIT=$?" |
| 53 | expect_output: EXIT=1 |
| 54 | match_type: contains |
| 55 | - name: '26. EXTENDED TEST COMMAND - FILE TYPE TESTS: test -p fifo (exit code)' |
| 56 | steps: |
| 57 | - send_line: test -p /tmp/posix_test_fifo |
| 58 | - send_line: echo "EXIT=$?" |
| 59 | expect_output: EXIT=1 |
| 60 | match_type: contains |
| 61 | - name: '27. EXTENDED TEST COMMAND - FILE PERMISSION TESTS: test -r readable (exit |
| 62 | code)' |
| 63 | steps: |
| 64 | - send_line: test -r /tmp/posix_test_readable |
| 65 | - send_line: echo "EXIT=$?" |
| 66 | expect_output: EXIT=1 |
| 67 | match_type: contains |
| 68 | - name: '27. EXTENDED TEST COMMAND - FILE PERMISSION TESTS: test -w writable (exit |
| 69 | code)' |
| 70 | steps: |
| 71 | - send_line: test -w /tmp/posix_test_writable |
| 72 | - send_line: echo "EXIT=$?" |
| 73 | expect_output: EXIT=1 |
| 74 | match_type: contains |
| 75 | - name: '27. EXTENDED TEST COMMAND - FILE PERMISSION TESTS: test -x executable (exit |
| 76 | code)' |
| 77 | steps: |
| 78 | - send_line: test -x /tmp/posix_test_executable |
| 79 | - send_line: echo "EXIT=$?" |
| 80 | expect_output: EXIT=1 |
| 81 | match_type: contains |
| 82 | - name: '27. EXTENDED TEST COMMAND - FILE PERMISSION TESTS: test ! -x nonexec (exit |
| 83 | code)' |
| 84 | steps: |
| 85 | - send_line: '! test -x /tmp/posix_test_readable' |
| 86 | - send_line: echo "EXIT=$?" |
| 87 | expect_output: EXIT=0 |
| 88 | match_type: contains |
| 89 | - name: '28. EXTENDED TEST COMMAND - FILE COMPARISON: test -nt newer than (exit code)' |
| 90 | steps: |
| 91 | - send_line: test /tmp/posix_test_new -nt /tmp/posix_test_old |
| 92 | - send_line: echo "EXIT=$?" |
| 93 | expect_output: EXIT=1 |
| 94 | match_type: contains |
| 95 | - name: '28. EXTENDED TEST COMMAND - FILE COMPARISON: test -ot older than (exit code)' |
| 96 | steps: |
| 97 | - send_line: test /tmp/posix_test_old -ot /tmp/posix_test_new |
| 98 | - send_line: echo "EXIT=$?" |
| 99 | expect_output: EXIT=1 |
| 100 | match_type: contains |
| 101 | - name: '28. EXTENDED TEST COMMAND - FILE COMPARISON: test -ef same file (exit code)' |
| 102 | steps: |
| 103 | - send_line: test /tmp/posix_test_old -ef /tmp/posix_test_hardlink |
| 104 | - send_line: echo "EXIT=$?" |
| 105 | expect_output: EXIT=1 |
| 106 | match_type: contains |
| 107 | - name: '29. EXTENDED TEST COMMAND - STRING TESTS: test -n nonempty string (exit code)' |
| 108 | steps: |
| 109 | - send_line: test -n 'hello' |
| 110 | - send_line: echo "EXIT=$?" |
| 111 | expect_output: EXIT=0 |
| 112 | match_type: contains |
| 113 | - name: '29. EXTENDED TEST COMMAND - STRING TESTS: test -z empty string (exit code)' |
| 114 | steps: |
| 115 | - send_line: test -z '' |
| 116 | - send_line: echo "EXIT=$?" |
| 117 | expect_output: EXIT=0 |
| 118 | match_type: contains |
| 119 | - name: '29. EXTENDED TEST COMMAND - STRING TESTS: test string = equal (exit code)' |
| 120 | steps: |
| 121 | - send_line: test 'abc' = 'abc' |
| 122 | - send_line: echo "EXIT=$?" |
| 123 | expect_output: EXIT=0 |
| 124 | match_type: contains |
| 125 | - name: '29. EXTENDED TEST COMMAND - STRING TESTS: test string != not equal (exit |
| 126 | code)' |
| 127 | steps: |
| 128 | - send_line: test 'abc' != 'xyz' |
| 129 | - send_line: echo "EXIT=$?" |
| 130 | expect_output: EXIT=0 |
| 131 | match_type: contains |
| 132 | - name: '29. EXTENDED TEST COMMAND - STRING TESTS: test unary string (exit code)' |
| 133 | steps: |
| 134 | - send_line: test 'hello' |
| 135 | - send_line: echo "EXIT=$?" |
| 136 | expect_output: EXIT=0 |
| 137 | match_type: contains |
| 138 | - name: '29. EXTENDED TEST COMMAND - STRING TESTS: test ! negation (exit code)' |
| 139 | steps: |
| 140 | - send_line: '! test -z ''hello''' |
| 141 | - send_line: echo "EXIT=$?" |
| 142 | expect_output: EXIT=0 |
| 143 | match_type: contains |
| 144 | - name: '30. EXTENDED TEST COMMAND - INTEGER COMPARISON: test -eq equal (exit code)' |
| 145 | steps: |
| 146 | - send_line: test 42 -eq 42 |
| 147 | - send_line: echo "EXIT=$?" |
| 148 | expect_output: EXIT=0 |
| 149 | match_type: contains |
| 150 | - name: '30. EXTENDED TEST COMMAND - INTEGER COMPARISON: test -ne not equal (exit |
| 151 | code)' |
| 152 | steps: |
| 153 | - send_line: test 42 -ne 13 |
| 154 | - send_line: echo "EXIT=$?" |
| 155 | expect_output: EXIT=0 |
| 156 | match_type: contains |
| 157 | - name: '30. EXTENDED TEST COMMAND - INTEGER COMPARISON: test -gt greater (exit code)' |
| 158 | steps: |
| 159 | - send_line: test 10 -gt 5 |
| 160 | - send_line: echo "EXIT=$?" |
| 161 | expect_output: EXIT=0 |
| 162 | match_type: contains |
| 163 | - name: '30. EXTENDED TEST COMMAND - INTEGER COMPARISON: test -ge greater or equal |
| 164 | (exit code)' |
| 165 | steps: |
| 166 | - send_line: test 10 -ge 10 |
| 167 | - send_line: echo "EXIT=$?" |
| 168 | expect_output: EXIT=0 |
| 169 | match_type: contains |
| 170 | - name: '30. EXTENDED TEST COMMAND - INTEGER COMPARISON: test -lt less (exit code)' |
| 171 | steps: |
| 172 | - send_line: test 5 -lt 10 |
| 173 | - send_line: echo "EXIT=$?" |
| 174 | expect_output: EXIT=0 |
| 175 | match_type: contains |
| 176 | - name: '30. EXTENDED TEST COMMAND - INTEGER COMPARISON: test -le less or equal (exit |
| 177 | code)' |
| 178 | steps: |
| 179 | - send_line: test 5 -le 5 |
| 180 | - send_line: echo "EXIT=$?" |
| 181 | expect_output: EXIT=0 |
| 182 | match_type: contains |
| 183 | - name: '30. EXTENDED TEST COMMAND - INTEGER COMPARISON: test negative numbers (exit |
| 184 | code)' |
| 185 | steps: |
| 186 | - send_line: test -5 -lt 0 |
| 187 | - send_line: echo "EXIT=$?" |
| 188 | expect_output: EXIT=0 |
| 189 | match_type: contains |
| 190 | - name: '31. EXTENDED TEST COMMAND - LOGICAL OPERATORS: test -a and (exit code)' |
| 191 | steps: |
| 192 | - send_line: test 5 -gt 3 -a 10 -gt 8 |
| 193 | - send_line: echo "EXIT=$?" |
| 194 | expect_output: EXIT=0 |
| 195 | match_type: contains |
| 196 | - name: '31. EXTENDED TEST COMMAND - LOGICAL OPERATORS: test -o or (exit code)' |
| 197 | steps: |
| 198 | - send_line: test 5 -gt 10 -o 10 -gt 8 |
| 199 | - send_line: echo "EXIT=$?" |
| 200 | expect_output: EXIT=0 |
| 201 | match_type: contains |
| 202 | - name: '31. EXTENDED TEST COMMAND - LOGICAL OPERATORS: test ! negation (exit code)' |
| 203 | steps: |
| 204 | - send_line: '! test 5 -gt 10' |
| 205 | - send_line: echo "EXIT=$?" |
| 206 | expect_output: EXIT=0 |
| 207 | match_type: contains |
| 208 | - name: '31. EXTENDED TEST COMMAND - LOGICAL OPERATORS: test ( ) grouping (exit code)' |
| 209 | steps: |
| 210 | - send_line: test \( 5 -gt 3 \) -a \( 10 -gt 8 \) |
| 211 | - send_line: echo "EXIT=$?" |
| 212 | expect_output: EXIT=0 |
| 213 | match_type: contains |
| 214 | - name: '32. EXTENDED PARAMETER EXPANSION - DEFAULT VALUES: use default unset' |
| 215 | steps: |
| 216 | - send_line: unset VAR; echo "${VAR-default}" |
| 217 | expect_output: default |
| 218 | match_type: contains |
| 219 | auto_fixed: shell_execution |
| 220 | - name: '32. EXTENDED PARAMETER EXPANSION - DEFAULT VALUES: use default null' |
| 221 | steps: |
| 222 | - send_line: VAR=; echo "${VAR-default}" |
| 223 | expect_output: '' |
| 224 | match_type: contains |
| 225 | auto_fixed: manual_determination |
| 226 | - name: '32. EXTENDED PARAMETER EXPANSION - DEFAULT VALUES: use default null colon' |
| 227 | steps: |
| 228 | - send_line: VAR=; echo "${VAR:-default}" |
| 229 | expect_output: default |
| 230 | match_type: contains |
| 231 | auto_fixed: shell_execution |
| 232 | - name: '32. EXTENDED PARAMETER EXPANSION - DEFAULT VALUES: use default set' |
| 233 | steps: |
| 234 | - send_line: VAR=value; echo "${VAR-default}" |
| 235 | expect_output: value |
| 236 | match_type: contains |
| 237 | auto_fixed: shell_execution |
| 238 | - name: '32. EXTENDED PARAMETER EXPANSION - DEFAULT VALUES: assign default unset' |
| 239 | steps: |
| 240 | - send_line: unset VAR; echo "${VAR=assigned}"; echo $VAR |
| 241 | expect_output: assigned |
| 242 | match_type: contains |
| 243 | - name: '32. EXTENDED PARAMETER EXPANSION - DEFAULT VALUES: assign default null colon' |
| 244 | steps: |
| 245 | - send_line: VAR=; echo "${VAR:=assigned}"; echo $VAR |
| 246 | expect_output: assigned |
| 247 | match_type: contains |
| 248 | - name: '33. EXTENDED PARAMETER EXPANSION - ERROR IF UNSET: no error if set' |
| 249 | steps: |
| 250 | - send_line: VAR=value; echo "${VAR?error}" |
| 251 | expect_output: value |
| 252 | match_type: contains |
| 253 | auto_fixed: shell_execution |
| 254 | - name: '34. EXTENDED PARAMETER EXPANSION - ALTERNATIVE VALUE: alt unset' |
| 255 | steps: |
| 256 | - send_line: unset VAR; echo "${VAR+alternative}" |
| 257 | expect_output: '' |
| 258 | match_type: contains |
| 259 | auto_fixed: manual_determination |
| 260 | - name: '34. EXTENDED PARAMETER EXPANSION - ALTERNATIVE VALUE: alt null' |
| 261 | steps: |
| 262 | - send_line: VAR=; echo "${VAR+alternative}" |
| 263 | expect_output: alternative |
| 264 | match_type: contains |
| 265 | auto_fixed: shell_execution |
| 266 | - name: '34. EXTENDED PARAMETER EXPANSION - ALTERNATIVE VALUE: alt null colon' |
| 267 | steps: |
| 268 | - send_line: VAR=; echo "${VAR:+alternative}" |
| 269 | expect_output: '' |
| 270 | match_type: contains |
| 271 | auto_fixed: manual_determination |
| 272 | - name: '34. EXTENDED PARAMETER EXPANSION - ALTERNATIVE VALUE: alt set' |
| 273 | steps: |
| 274 | - send_line: VAR=value; echo "${VAR+alternative}" |
| 275 | expect_output: alternative |
| 276 | match_type: contains |
| 277 | auto_fixed: shell_execution |
| 278 | - name: '34. EXTENDED PARAMETER EXPANSION - ALTERNATIVE VALUE: alt set colon' |
| 279 | steps: |
| 280 | - send_line: VAR=value; echo "${VAR:+alternative}" |
| 281 | expect_output: alternative |
| 282 | match_type: contains |
| 283 | auto_fixed: shell_execution |
| 284 | - name: '35. EXTENDED PARAMETER EXPANSION - STRING LENGTH: length empty' |
| 285 | steps: |
| 286 | - send_line: VAR=; echo "${#VAR}" |
| 287 | expect_output: '0' |
| 288 | match_type: contains |
| 289 | auto_fixed: shell_execution |
| 290 | - name: '35. EXTENDED PARAMETER EXPANSION - STRING LENGTH: length short' |
| 291 | steps: |
| 292 | - send_line: VAR=hi; echo "${#VAR}" |
| 293 | expect_output: '2' |
| 294 | match_type: contains |
| 295 | - name: '35. EXTENDED PARAMETER EXPANSION - STRING LENGTH: length long' |
| 296 | steps: |
| 297 | - send_line: VAR="hello world"; echo "${#VAR}" |
| 298 | expect_output: '11' |
| 299 | match_type: contains |
| 300 | - name: '35. EXTENDED PARAMETER EXPANSION - STRING LENGTH: length special chars' |
| 301 | steps: |
| 302 | - send_line: VAR="a b c"; echo "${#VAR}" |
| 303 | expect_output: '5' |
| 304 | match_type: contains |
| 305 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: prefix # simple' |
| 306 | steps: |
| 307 | - send_line: VAR=hello; echo "${VAR#hel}" |
| 308 | expect_output: lo |
| 309 | match_type: contains |
| 310 | auto_fixed: shell_execution |
| 311 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: prefix # nomatch' |
| 312 | steps: |
| 313 | - send_line: VAR=hello; echo "${VAR#xyz}" |
| 314 | expect_output: hello |
| 315 | match_type: contains |
| 316 | auto_fixed: shell_execution |
| 317 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: prefix # glob' |
| 318 | steps: |
| 319 | - send_line: VAR=foo.bar.baz; echo "${VAR#*.}" |
| 320 | expect_output: bar.baz |
| 321 | match_type: contains |
| 322 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: prefix ## glob' |
| 323 | steps: |
| 324 | - send_line: VAR=foo.bar.baz; echo "${VAR##*.}" |
| 325 | expect_output: baz |
| 326 | match_type: contains |
| 327 | auto_fixed: shell_execution |
| 328 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: prefix # star' |
| 329 | steps: |
| 330 | - send_line: VAR=/usr/local/bin; echo "${VAR#*/}" |
| 331 | expect_output: usr/local/bin |
| 332 | match_type: contains |
| 333 | auto_fixed: shell_execution |
| 334 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: prefix ## star' |
| 335 | steps: |
| 336 | - send_line: VAR=/usr/local/bin; echo "${VAR##*/}" |
| 337 | expect_output: bin |
| 338 | match_type: contains |
| 339 | auto_fixed: shell_execution |
| 340 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: suffix % simple' |
| 341 | steps: |
| 342 | - send_line: VAR=hello; echo "${VAR%lo}" |
| 343 | expect_output: hel |
| 344 | match_type: contains |
| 345 | auto_fixed: shell_execution |
| 346 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: suffix % nomatch' |
| 347 | steps: |
| 348 | - send_line: VAR=hello; echo "${VAR%xyz}" |
| 349 | expect_output: hello |
| 350 | match_type: contains |
| 351 | auto_fixed: shell_execution |
| 352 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: suffix % glob' |
| 353 | steps: |
| 354 | - send_line: VAR=foo.bar.baz; echo "${VAR%.*}" |
| 355 | expect_output: foo.bar |
| 356 | match_type: contains |
| 357 | auto_fixed: shell_execution |
| 358 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: suffix %% glob' |
| 359 | steps: |
| 360 | - send_line: VAR=foo.bar.baz; echo "${VAR%%.*}" |
| 361 | expect_output: foo |
| 362 | match_type: contains |
| 363 | auto_fixed: shell_execution |
| 364 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: suffix % extension' |
| 365 | steps: |
| 366 | - send_line: VAR=file.tar.gz; echo "${VAR%.gz}" |
| 367 | expect_output: file.tar |
| 368 | match_type: contains |
| 369 | auto_fixed: shell_execution |
| 370 | - name: '36. EXTENDED PARAMETER EXPANSION - PATTERN REMOVAL: suffix %% extension' |
| 371 | steps: |
| 372 | - send_line: VAR=file.tar.gz; echo "${VAR%%.*}" |
| 373 | expect_output: file |
| 374 | match_type: contains |
| 375 | auto_fixed: shell_execution |
| 376 | - name: '37. ARITHMETIC EXPANSION - BASIC OPERATIONS: arith addition' |
| 377 | steps: |
| 378 | - send_line: echo $((5 + 3)) |
| 379 | expect_output: '8' |
| 380 | match_type: contains |
| 381 | auto_fixed: shell_execution |
| 382 | - name: '37. ARITHMETIC EXPANSION - BASIC OPERATIONS: arith subtraction' |
| 383 | steps: |
| 384 | - send_line: echo $((10 - 4)) |
| 385 | expect_output: '6' |
| 386 | match_type: contains |
| 387 | auto_fixed: shell_execution |
| 388 | - name: '37. ARITHMETIC EXPANSION - BASIC OPERATIONS: arith multiplication' |
| 389 | steps: |
| 390 | - send_line: echo $((6 * 7)) |
| 391 | expect_output: '42' |
| 392 | match_type: contains |
| 393 | auto_fixed: shell_execution |
| 394 | - name: '37. ARITHMETIC EXPANSION - BASIC OPERATIONS: arith division' |
| 395 | steps: |
| 396 | - send_line: echo $((20 / 4)) |
| 397 | expect_output: '5' |
| 398 | match_type: contains |
| 399 | auto_fixed: shell_execution |
| 400 | - name: '37. ARITHMETIC EXPANSION - BASIC OPERATIONS: arith modulo' |
| 401 | steps: |
| 402 | - send_line: echo $((17 % 5)) |
| 403 | expect_output: '2' |
| 404 | match_type: contains |
| 405 | auto_fixed: shell_execution |
| 406 | - name: '37. ARITHMETIC EXPANSION - BASIC OPERATIONS: arith negative' |
| 407 | steps: |
| 408 | - send_line: echo $((-5 + 10)) |
| 409 | expect_output: '5' |
| 410 | match_type: contains |
| 411 | auto_fixed: shell_execution |
| 412 | - name: '37. ARITHMETIC EXPANSION - BASIC OPERATIONS: arith zero' |
| 413 | steps: |
| 414 | - send_line: echo $((0 + 0)) |
| 415 | expect_output: '0' |
| 416 | match_type: contains |
| 417 | auto_fixed: shell_execution |
| 418 | - name: '38. ARITHMETIC EXPANSION - PRECEDENCE: arith precedence mult' |
| 419 | steps: |
| 420 | - send_line: echo $((2 + 3 * 4)) |
| 421 | expect_output: '14' |
| 422 | match_type: contains |
| 423 | auto_fixed: shell_execution |
| 424 | - name: '38. ARITHMETIC EXPANSION - PRECEDENCE: arith precedence paren' |
| 425 | steps: |
| 426 | - send_line: echo $(((2 + 3) * 4)) |
| 427 | expect_output: '20' |
| 428 | match_type: contains |
| 429 | auto_fixed: shell_execution |
| 430 | - name: '38. ARITHMETIC EXPANSION - PRECEDENCE: arith precedence div' |
| 431 | steps: |
| 432 | - send_line: echo $((10 - 8 / 2)) |
| 433 | expect_output: '6' |
| 434 | match_type: contains |
| 435 | auto_fixed: shell_execution |
| 436 | - name: '38. ARITHMETIC EXPANSION - PRECEDENCE: arith precedence complex' |
| 437 | steps: |
| 438 | - send_line: echo $((2 * 3 + 4 * 5)) |
| 439 | expect_output: '26' |
| 440 | match_type: contains |
| 441 | auto_fixed: shell_execution |
| 442 | - name: '39. ARITHMETIC EXPANSION - VARIABLES: arith var' |
| 443 | steps: |
| 444 | - send_line: X=5; echo $((X + 3)) |
| 445 | expect_output: '8' |
| 446 | match_type: contains |
| 447 | auto_fixed: shell_execution |
| 448 | - name: '39. ARITHMETIC EXPANSION - VARIABLES: arith var no dollar' |
| 449 | steps: |
| 450 | - send_line: X=10; Y=20; echo $((X + Y)) |
| 451 | expect_output: '30' |
| 452 | match_type: contains |
| 453 | auto_fixed: shell_execution |
| 454 | - name: '39. ARITHMETIC EXPANSION - VARIABLES: arith var assign' |
| 455 | steps: |
| 456 | - send_line: X=5; Y=$((X * 2)); echo $Y |
| 457 | expect_output: '10' |
| 458 | match_type: contains |
| 459 | auto_fixed: shell_execution |
| 460 | - name: '39. ARITHMETIC EXPANSION - VARIABLES: arith var complex' |
| 461 | steps: |
| 462 | - send_line: A=3; B=4; echo $((A * A + B * B)) |
| 463 | expect_output: '25' |
| 464 | match_type: contains |
| 465 | auto_fixed: shell_execution |
| 466 | - name: '40. ARITHMETIC EXPANSION - COMPARISON: arith compare eq true' |
| 467 | steps: |
| 468 | - send_line: echo $((5 == 5)) |
| 469 | expect_output: '1' |
| 470 | match_type: contains |
| 471 | auto_fixed: shell_execution |
| 472 | - name: '40. ARITHMETIC EXPANSION - COMPARISON: arith compare eq false' |
| 473 | steps: |
| 474 | - send_line: echo $((5 == 3)) |
| 475 | expect_output: '0' |
| 476 | match_type: contains |
| 477 | auto_fixed: shell_execution |
| 478 | - name: '40. ARITHMETIC EXPANSION - COMPARISON: arith compare ne true' |
| 479 | steps: |
| 480 | - send_line: echo $((5 != 3)) |
| 481 | expect_output: '1' |
| 482 | match_type: contains |
| 483 | auto_fixed: shell_execution |
| 484 | - name: '40. ARITHMETIC EXPANSION - COMPARISON: arith compare ne false' |
| 485 | steps: |
| 486 | - send_line: echo $((5 != 5)) |
| 487 | expect_output: '0' |
| 488 | match_type: contains |
| 489 | auto_fixed: shell_execution |
| 490 | - name: '40. ARITHMETIC EXPANSION - COMPARISON: arith compare lt' |
| 491 | steps: |
| 492 | - send_line: echo $((3 < 5)) |
| 493 | expect_output: '1' |
| 494 | match_type: contains |
| 495 | auto_fixed: shell_execution |
| 496 | - name: '40. ARITHMETIC EXPANSION - COMPARISON: arith compare le' |
| 497 | steps: |
| 498 | - send_line: echo $((5 <= 5)) |
| 499 | expect_output: '1' |
| 500 | match_type: contains |
| 501 | auto_fixed: shell_execution |
| 502 | - name: '40. ARITHMETIC EXPANSION - COMPARISON: arith compare gt' |
| 503 | steps: |
| 504 | - send_line: echo $((7 > 5)) |
| 505 | expect_output: '1' |
| 506 | match_type: contains |
| 507 | auto_fixed: shell_execution |
| 508 | - name: '40. ARITHMETIC EXPANSION - COMPARISON: arith compare ge' |
| 509 | steps: |
| 510 | - send_line: echo $((5 >= 5)) |
| 511 | expect_output: '1' |
| 512 | match_type: contains |
| 513 | auto_fixed: shell_execution |
| 514 | - name: '41. ARITHMETIC EXPANSION - LOGICAL: arith logical and true' |
| 515 | steps: |
| 516 | - send_line: echo $((1 && 1)) |
| 517 | expect_output: '1' |
| 518 | match_type: contains |
| 519 | auto_fixed: shell_execution |
| 520 | - name: '41. ARITHMETIC EXPANSION - LOGICAL: arith logical and false' |
| 521 | steps: |
| 522 | - send_line: echo $((1 && 0)) |
| 523 | expect_output: '0' |
| 524 | match_type: contains |
| 525 | auto_fixed: shell_execution |
| 526 | - name: '41. ARITHMETIC EXPANSION - LOGICAL: arith logical or true' |
| 527 | steps: |
| 528 | - send_line: echo $((0 || 1)) |
| 529 | expect_output: '1' |
| 530 | match_type: contains |
| 531 | auto_fixed: shell_execution |
| 532 | - name: '41. ARITHMETIC EXPANSION - LOGICAL: arith logical or false' |
| 533 | steps: |
| 534 | - send_line: echo $((0 || 0)) |
| 535 | expect_output: '0' |
| 536 | match_type: contains |
| 537 | auto_fixed: shell_execution |
| 538 | - name: '41. ARITHMETIC EXPANSION - LOGICAL: arith logical not true' |
| 539 | steps: |
| 540 | - send_line: echo $((! 0)) |
| 541 | expect_output: '1' |
| 542 | match_type: contains |
| 543 | auto_fixed: shell_execution |
| 544 | - name: '41. ARITHMETIC EXPANSION - LOGICAL: arith logical not false' |
| 545 | steps: |
| 546 | - send_line: echo $((! 1)) |
| 547 | expect_output: '0' |
| 548 | match_type: contains |
| 549 | auto_fixed: shell_execution |
| 550 | - name: '42. SPECIAL PARAMETERS: \$\$ process id type' |
| 551 | steps: |
| 552 | - send_line: echo $$ | grep -c "^[0-9][0-9]*$" |
| 553 | expect_output: '1' |
| 554 | match_type: contains |
| 555 | auto_fixed: shell_execution |
| 556 | - name: '42. SPECIAL PARAMETERS: \$- shell flags type' |
| 557 | steps: |
| 558 | - send_line: echo $- | grep -c '[a-z]' |
| 559 | expect_output: '1' |
| 560 | match_type: contains |
| 561 | - name: '42. SPECIAL PARAMETERS: \$# arg count' |
| 562 | steps: |
| 563 | - send_line: set -- a b c; echo $# |
| 564 | expect_output: '3' |
| 565 | match_type: contains |
| 566 | auto_fixed: shell_execution |
| 567 | - name: '42. SPECIAL PARAMETERS: \$1 first arg' |
| 568 | steps: |
| 569 | - send_line: set -- first second; echo $1 |
| 570 | expect_output: first |
| 571 | match_type: contains |
| 572 | auto_fixed: shell_execution |
| 573 | - name: '42. SPECIAL PARAMETERS: \$2 second arg' |
| 574 | steps: |
| 575 | - send_line: set -- first second; echo $2 |
| 576 | expect_output: second |
| 577 | match_type: contains |
| 578 | auto_fixed: shell_execution |
| 579 | - name: '42. SPECIAL PARAMETERS: \$9 ninth arg' |
| 580 | steps: |
| 581 | - send_line: set -- a b c d e f g h i j; echo $9 |
| 582 | expect_output: i |
| 583 | match_type: contains |
| 584 | auto_fixed: shell_execution |
| 585 | - name: '42. SPECIAL PARAMETERS: \$* all args' |
| 586 | steps: |
| 587 | - send_line: set -- a b c; echo $* |
| 588 | expect_output: a b c |
| 589 | match_type: contains |
| 590 | auto_fixed: shell_execution |
| 591 | - name: '42. SPECIAL PARAMETERS: \$@ all args' |
| 592 | steps: |
| 593 | - send_line: set -- a b c; echo $@ |
| 594 | expect_output: a b c |
| 595 | match_type: contains |
| 596 | auto_fixed: shell_execution |
| 597 | - name: '43. ADDITIONAL POSIX BUILTINS - CD/PWD: cd to /tmp' |
| 598 | steps: |
| 599 | - send_line: cd /tmp && pwd |
| 600 | expect_output: /tmp |
| 601 | match_type: contains |
| 602 | auto_fixed: shell_execution |
| 603 | - name: '43. ADDITIONAL POSIX BUILTINS - CD/PWD: cd relative' |
| 604 | steps: |
| 605 | - send_line: cd /tmp && cd .. && pwd | grep -c "^/" |
| 606 | expect_output: '1' |
| 607 | match_type: contains |
| 608 | - name: '43. ADDITIONAL POSIX BUILTINS - CD/PWD: cd $HOME' |
| 609 | steps: |
| 610 | - send_line: cd && pwd | grep -c "^/" |
| 611 | expect_output: '1' |
| 612 | match_type: contains |
| 613 | - name: '44. ADDITIONAL POSIX BUILTINS - UNSET: unset variable' |
| 614 | steps: |
| 615 | - send_line: VAR=test; unset VAR; echo ${VAR:-unset} |
| 616 | expect_output: unset |
| 617 | match_type: contains |
| 618 | auto_fixed: shell_execution |
| 619 | - name: '44. ADDITIONAL POSIX BUILTINS - UNSET: unset nonexistent' |
| 620 | steps: |
| 621 | - send_line: unset NONEXISTENT_VAR_XYZ; echo ok |
| 622 | expect_output: ok |
| 623 | match_type: contains |
| 624 | - name: '45. ADDITIONAL POSIX BUILTINS - EVAL: eval simple' |
| 625 | steps: |
| 626 | - send_line: CMD="echo hello"; eval $CMD |
| 627 | expect_output: hello |
| 628 | match_type: contains |
| 629 | auto_fixed: shell_execution |
| 630 | - name: '45. ADDITIONAL POSIX BUILTINS - EVAL: eval with var' |
| 631 | steps: |
| 632 | - send_line: X=5; CMD="echo $X"; eval $CMD |
| 633 | expect_output: '5' |
| 634 | match_type: contains |
| 635 | auto_fixed: shell_execution |
| 636 | - name: '45. ADDITIONAL POSIX BUILTINS - EVAL: eval complex' |
| 637 | steps: |
| 638 | - send_line: A=echo; B=test; eval $A $B |
| 639 | expect_output: test |
| 640 | match_type: contains |
| 641 | auto_fixed: shell_execution |
| 642 | - name: '46. ADDITIONAL POSIX BUILTINS - COLON: : null command' |
| 643 | steps: |
| 644 | - send_line: ': ; echo ok' |
| 645 | expect_output: ok |
| 646 | match_type: contains |
| 647 | - name: '46. ADDITIONAL POSIX BUILTINS - COLON: : with args' |
| 648 | steps: |
| 649 | - send_line: ': this is ignored; echo ok' |
| 650 | expect_output: ok |
| 651 | match_type: contains |
| 652 | - name: '47. TILDE EXPANSION: tilde home' |
| 653 | steps: |
| 654 | - send_line: echo ~ | grep -c "^/" |
| 655 | expect_output: '1' |
| 656 | match_type: contains |
| 657 | - name: '47. TILDE EXPANSION: tilde in path' |
| 658 | steps: |
| 659 | - send_line: echo ~/test | grep -c "^/" |
| 660 | expect_output: '1' |
| 661 | match_type: contains |
| 662 | - name: '48. FIELD SPLITTING - ADVANCED: IFS multiple fields' |
| 663 | steps: |
| 664 | - send_line: IFS=:; VAR="a:b:c:d"; set -- $VAR; echo $# $1 $4 |
| 665 | expect_output: 4 a d |
| 666 | match_type: contains |
| 667 | auto_fixed: shell_execution |
| 668 | - name: '48. FIELD SPLITTING - ADVANCED: IFS whitespace' |
| 669 | steps: |
| 670 | - send_line: IFS=" "; VAR="a b c"; set -- $VAR; echo $# |
| 671 | expect_output: '3' |
| 672 | match_type: contains |
| 673 | auto_fixed: shell_execution |
| 674 | - name: '48. FIELD SPLITTING - ADVANCED: IFS comma' |
| 675 | steps: |
| 676 | - send_line: IFS=,; VAR="x,y,z"; set -- $VAR; echo $2 |
| 677 | expect_output: y |
| 678 | match_type: contains |
| 679 | auto_fixed: shell_execution |
| 680 | - name: '49. BACKGROUND JOBS: background exit' |
| 681 | steps: |
| 682 | - send_line: (exit 0) & wait $!; echo $? |
| 683 | expect_output: '0' |
| 684 | match_type: contains |
| 685 | auto_fixed: shell_execution |
| 686 | - name: '50. COMMAND GROUPING: subshell isolation' |
| 687 | steps: |
| 688 | - send_line: X=1; (X=2; echo $X); echo $X |
| 689 | expect_output: '2' |
| 690 | match_type: contains |
| 691 | - name: '50. COMMAND GROUPING: brace grouping' |
| 692 | steps: |
| 693 | - send_line: X=1; { X=2; echo $X; }; echo $X |
| 694 | expect_output: '2' |
| 695 | match_type: contains |
| 696 | - name: '50. COMMAND GROUPING: subshell exit' |
| 697 | steps: |
| 698 | - send_line: (exit 5); echo $? |
| 699 | expect_output: '5' |
| 700 | match_type: contains |
| 701 | auto_fixed: shell_execution |
| 702 |