diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-06-01 01:23:55 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-06-01 01:23:55 +0300 |
commit | 8f0390dfa6d66ed322f6d4ad2306353c1669bfac (patch) | |
tree | db16403455af80a60a8fab8e13433a4445f51c33 /tests/wildcard | |
parent | 22dcb13424c3a098e2f87716a9ca6e72f610f845 (diff) |
Remove redundant assertion in path_match(path, path, dir_path)
Diffstat (limited to 'tests/wildcard')
-rw-r--r-- | tests/wildcard/driver.cxx | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/tests/wildcard/driver.cxx b/tests/wildcard/driver.cxx index bbe75a8..cecee07 100644 --- a/tests/wildcard/driver.cxx +++ b/tests/wildcard/driver.cxx @@ -172,38 +172,45 @@ try else path_search (pattern, *entry, add, start); - // Test search in the directory tree represented by the path. + // It the search succeeds, then test search in the directory tree + // represented by each matched path. Otherwise, if the directory tree is + // specified, then make sure that it doesn't match the pattern. // - for (const auto& p: path_count) + if (!path_count.empty ()) { - // Will match multiple times if the pattern contains several recursive - // components. - // - size_t match_count (0); - - auto check = [&p, &match_count] (path&& pe, const string&, bool interim) + for (const auto& p: path_count) { - if (pe == p.first) + // Will match multiple times if the pattern contains several recursive + // components. + // + size_t match_count (0); + + auto check = [&p, &match_count] (path&& pe, const string&, bool inter) { - if (!interim) - ++match_count; - else - // For self-matching the callback is first called in the interim - // mode (through the preopen function) with an empty path. - // - assert (pe.empty ()); - } - - return true; - }; - - path_search (pattern, p.first, check, start); - assert (match_count == p.second); - - // Test path match. - // - assert (path_match (pattern, p.first, start)); + if (pe == p.first) + { + if (!inter) + ++match_count; + else + // For self-matching the callback is first called in the interim + // mode (through the preopen function) with an empty path. + // + assert (pe.empty ()); + } + + return true; + }; + + path_search (pattern, p.first, check, start); + assert (match_count == p.second); + + // Test path match. + // + assert (path_match (pattern, p.first, start)); + } } + else if (entry) + assert (!path_match (pattern, *entry, start)); // Print the found paths. // |