aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-08-01 17:01:44 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-08-08 13:55:48 -0700
commit761651d410ffca7627fdc6180698bdd9d56553b0 (patch)
treedfb16ea933cd10e332c3e8d86c50903906ad9a48 /src
parent70548f7cc75ea9dcf325d8f2a87126a845e9dc46 (diff)
Add some expansion tests
Diffstat (limited to 'src')
-rw-r--r--src/fish_tests.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp
index 99928290..baa6e53a 100644
--- a/src/fish_tests.cpp
+++ b/src/fish_tests.cpp
@@ -1442,14 +1442,39 @@ static void test_expand()
L"Failed to handle dollar sign in variable-skipping expansion");
if (system("mkdir -p /tmp/fish_expand_test/")) err(L"mkdir failed");
+ if (system("mkdir -p /tmp/fish_expand_test/baz/")) err(L"mkdir failed");
+ if (system("mkdir -p /tmp/fish_expand_test/bax/")) err(L"mkdir failed");
if (system("touch /tmp/fish_expand_test/.foo")) err(L"touch failed");
if (system("touch /tmp/fish_expand_test/bar")) err(L"touch failed");
+ if (system("touch /tmp/fish_expand_test/bax/xxx")) err(L"touch failed");
+ if (system("touch /tmp/fish_expand_test/baz/xxx")) err(L"touch failed");
// This is checking that .* does NOT match . and .. (https://github.com/fish-shell/fish-shell/issues/270). But it does have to match literal components (e.g. "./*" has to match the same as "*"
- expand_test(L"/tmp/fish_expand_test/.*", 0, L"/tmp/fish_expand_test/.foo", 0,
+ const wchar_t * const wnull = NULL;
+ expand_test(L"/tmp/fish_expand_test/.*", 0,
+ L"/tmp/fish_expand_test/.foo", wnull,
L"Expansion not correctly handling dotfiles");
- expand_test(L"/tmp/fish_expand_test/./.*", 0, L"/tmp/fish_expand_test/./.foo", 0,
+
+ expand_test(L"/tmp/fish_expand_test/./.*", 0,
+ L"/tmp/fish_expand_test/./.foo", wnull,
L"Expansion not correctly handling literal path components in dotfiles");
+
+ expand_test(L"/tmp/fish_expand_test/*/xxx", 0,
+ L"/tmp/fish_expand_test/bax/xxx", L"/tmp/fish_expand_test/baz/xxx", wnull,
+ L"Glob did the wrong thing");
+
+ expand_test(L"/tmp/fish_expand_test/*z/xxx", 0,
+ L"/tmp/fish_expand_test/baz/xxx", wnull,
+ L"Glob did the wrong thing");
+
+ expand_test(L"/tmp/fish_expand_test/**z/xxx", 0,
+ L"/tmp/fish_expand_test/baz/xxx", wnull,
+ L"Glob did the wrong thing");
+
+ expand_test(L"/tmp/fish_expand_test/b**", 0,
+ L"/tmp/fish_expand_test/bar", L"/tmp/fish_expand_test/bax", L"/tmp/fish_expand_test/bax/xxx", L"/tmp/fish_expand_test/baz", L"/tmp/fish_expand_test/baz/xxx", wnull,
+ L"Glob did the wrong thing");
+
if (! expand_test(L"/tmp/fish_expand_test/.*", 0, L"/tmp/fish_expand_test/.foo", 0))
{