Shell: Add some tests for brace expansions
This commit is contained in:
parent
107a083b5a
commit
f7dbd14a87
Notes:
sideshowbarker
2024-07-19 01:46:08 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/f7dbd14a87b Pull-request: https://github.com/SerenityOS/serenity/pull/3835 Issue: https://github.com/SerenityOS/serenity/issues/3832 Reviewed-by: https://github.com/bugaevc Reviewed-by: https://github.com/linusg
1 changed files with 21 additions and 0 deletions
21
Shell/Tests/brace-exp.sh
Normal file
21
Shell/Tests/brace-exp.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
setopt --verbose
|
||||
|
||||
fail() {
|
||||
echo $*
|
||||
exit 1
|
||||
}
|
||||
|
||||
test "$(echo {a,b,})" = "a b " || fail normal brace expansion with one empty slot
|
||||
test "$(echo {a,,b})" = "a b" || fail normal brace expansion with one empty slot
|
||||
test "$(echo {a,,,b})" = "a b" || fail normal brace expansion with two empty slots
|
||||
test "$(echo {a,b,,})" = "a b " || fail normal brace expansion with two empty slots
|
||||
|
||||
test "$(echo {a..c})" = "a b c" || fail range brace expansion, alpha
|
||||
test "$(echo {0..3})" = "0 1 2 3" || fail range brace expansion, number
|
||||
test "$(echo {😂..😄})" = "😂 😃 😄" || fail range brace expansion, unicode codepoint
|
||||
|
||||
# Make sure that didn't mess with dots and commas in normal barewords
|
||||
test .. = ".." || fail range brace expansion delimiter affects normal barewords
|
||||
test , = "," || fail normal brace expansion delimiter affects normal barewords
|
Loading…
Add table
Reference in a new issue