v2.6.0 (#524)
Co-authored-by: Clément Drouin <clement.drouin@mistral.ai> Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai> Co-authored-by: Gauthier Guinet <43207538+Gguinet@users.noreply.github.com> Co-authored-by: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai> Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com> Co-authored-by: Quentin <torroba.q@gmail.com> Co-authored-by: Simon <80467011+sorgfresser@users.noreply.github.com> Co-authored-by: Simon Van de Kerckhove <simon.vandekerckhove@mistral.ai> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: angelapopopo <angele.lenglemetz@mistral.ai> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
5103019b01
commit
eb580209d4
180 changed files with 11136 additions and 1030 deletions
66
tests/tools/test_wildcard_match.py
Normal file
66
tests/tools/test_wildcard_match.py
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from vibe.core.tools.utils import wildcard_match
|
||||
|
||||
|
||||
class TestWildcardMatch:
|
||||
def test_exact_match(self):
|
||||
assert wildcard_match("hello", "hello")
|
||||
|
||||
def test_exact_no_match(self):
|
||||
assert not wildcard_match("hello", "world")
|
||||
|
||||
def test_star_matches_any(self):
|
||||
assert wildcard_match("hello world", "hello *")
|
||||
|
||||
def test_star_matches_empty_trailing(self):
|
||||
assert wildcard_match("mkdir", "mkdir *")
|
||||
|
||||
def test_star_matches_with_args(self):
|
||||
assert wildcard_match("mkdir hello", "mkdir *")
|
||||
|
||||
def test_star_matches_long_trailing(self):
|
||||
assert wildcard_match("git commit -m hello world", "git commit *")
|
||||
|
||||
def test_star_in_middle(self):
|
||||
assert wildcard_match("fooXbar", "foo*bar")
|
||||
|
||||
def test_question_mark_single_char(self):
|
||||
assert wildcard_match("cat", "c?t")
|
||||
|
||||
def test_question_mark_no_match(self):
|
||||
assert not wildcard_match("ct", "c?t")
|
||||
|
||||
def test_glob_path_pattern(self):
|
||||
assert wildcard_match("/tmp/dir/file.txt", "/tmp/dir/*")
|
||||
|
||||
def test_glob_nested_path(self):
|
||||
assert wildcard_match("/tmp/dir/sub/file.txt", "/tmp/dir/*")
|
||||
|
||||
def test_glob_no_match(self):
|
||||
assert not wildcard_match("/home/user/file.txt", "/tmp/*")
|
||||
|
||||
def test_special_regex_chars_in_text(self):
|
||||
assert wildcard_match("echo (hello)", "echo *")
|
||||
|
||||
def test_special_regex_chars_in_pattern(self):
|
||||
assert wildcard_match(".env", ".env")
|
||||
assert not wildcard_match("xenv", ".env")
|
||||
|
||||
def test_fnmatch_character_class(self):
|
||||
assert wildcard_match("vache", "[bcghlmstv]ache")
|
||||
|
||||
def test_empty_pattern_empty_text(self):
|
||||
assert wildcard_match("", "")
|
||||
|
||||
def test_star_only(self):
|
||||
assert wildcard_match("anything goes here", "*")
|
||||
|
||||
def test_trailing_space_star_is_optional(self):
|
||||
assert wildcard_match("ls", "ls *")
|
||||
assert wildcard_match("ls -la", "ls *")
|
||||
assert wildcard_match("ls -la /tmp", "ls *")
|
||||
|
||||
def test_non_trailing_star_is_greedy(self):
|
||||
assert wildcard_match("abc123def", "abc*def")
|
||||
assert not wildcard_match("abc123de", "abc*def")
|
||||
Loading…
Add table
Add a link
Reference in a new issue