summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-02-02 11:50:53 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-02-02 11:50:53 -0500
commitd83ffb41c7f5d42bfb43a19e38ab3d1331f0d86e (patch)
tree5fb8a6cf29feaf875740cd44291b29ab4e22ee85 /tests.sh
parent6b1ecc327f2a1931342ecee1bebc247fa455c678 (diff)
downloadbfs-d83ffb41c7f5d42bfb43a19e38ab3d1331f0d86e.tar.xz
tests: Add tests for syntactically invalid globs
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests.sh b/tests.sh
index 0990110..940187e 100755
--- a/tests.sh
+++ b/tests.sh
@@ -233,6 +233,10 @@ posix_tests=(
test_name_root_depth
test_name_trailing_slash
test_name_star_star
+ test_name_character_class
+ test_name_bracket
+ test_name_backslash
+ test_name_double_backslash
test_newer
test_newer_link
@@ -993,6 +997,7 @@ function make_weirdnames() {
touchp "$1/.../h"
touchp "$1/\\/i"
touchp "$1/ /j"
+ touchp "$1/[/k"
}
make_weirdnames "$TMP/weirdnames"
@@ -1301,6 +1306,25 @@ function test_name_star_star() {
bfs_diff basic -name '**f**'
}
+function test_name_character_class() {
+ bfs_diff basic -name '[e-g][!a-n][!p-z]'
+}
+
+function test_name_bracket() {
+ # An unclosed [ should be matched literally
+ bfs_diff weirdnames -name '['
+}
+
+function test_name_backslash() {
+ # An unescaped \ doesn't match
+ bfs_diff weirdnames -name '\'
+}
+
+function test_name_double_backslash() {
+ # An escaped \\ matches
+ bfs_diff weirdnames -name '\\'
+}
+
function test_path() {
bfs_diff basic -path 'basic/*f*'
}