aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-08-08 15:25:07 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-08-08 15:25:07 -0700
commit3bd6eab88ff88d3fd2cabd19736922d932461d6b (patch)
treeab41d23f77a6deb9fee798b7825aa7db83f32478 /src
parent3a3a9f5cc15ccfc9f171f8916c5a0470a3585319 (diff)
Make expansion test robust against different filesystem orders
Should make the tests pass on Linux
Diffstat (limited to 'src')
-rw-r--r--src/fish_tests.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp
index 4a1c9563..526ccd44 100644
--- a/src/fish_tests.cpp
+++ b/src/fish_tests.cpp
@@ -1366,25 +1366,22 @@ static bool expand_test(const wchar_t *in, expand_flags_t flags, ...)
expected.push_back(wcstring(arg));
}
va_end(va);
-
- wcstring_list_t::const_iterator exp_it = expected.begin(), exp_end = expected.end();
+
+ std::set<wcstring> remaining(expected.begin(), expected.end());
std::vector<completion_t>::const_iterator out_it = output.begin(), out_end = output.end();
- for (; exp_it != exp_end || out_it != out_end; ++exp_it, ++out_it)
+ for (; out_it != out_end; ++out_it)
{
- if (exp_it == exp_end || out_it == out_end)
- {
- // sizes don't match
- res = false;
- break;
- }
-
- if (out_it->completion != *exp_it)
+ if (! remaining.erase(out_it->completion))
{
res = false;
break;
}
}
-
+ if (! remaining.empty())
+ {
+ res = false;
+ }
+
if (!res)
{
if ((arg = va_arg(va, wchar_t *)) != 0)