diff options
| author | ruki <[email protected]> | 2026-09-06 15:27:25 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-09-06 15:27:25 +0800 |
| commit | 2c1fdfbea285c696350e795af7c4d45a2000acf1 (patch) | |
| tree | 3f8cb32e2ab693f5a8518046a93cfb053df162c3 /tests/modules/os | |
| parent | 266ac8a9c87209d6a828c140393af042e74d3e6c (diff) | |
| parent | 8102c104461c1bb71a13e4531c59e23e371d35be (diff) | |
Merge pull request #7753 from zjncs/fix-path-pattern-escape-bracketsmaster
escape brackets in path.pattern
Diffstat (limited to 'tests/modules/os')
| -rw-r--r-- | tests/modules/os/test.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/modules/os/test.lua b/tests/modules/os/test.lua index 2dcab35c6..d24615fd4 100644 --- a/tests/modules/os/test.lua +++ b/tests/modules/os/test.lua @@ -208,3 +208,13 @@ function test_isexec(t) os.tryrm(tempdir) end + +function test_files_with_brackets(t) + local tmpdir = os.tmpfile() .. ".dir" + io.writefile(path.join(tmpdir, "a[1].lua"), "x") + io.writefile(path.join(tmpdir, "a1.lua"), "x") + -- a wildcard is required, a plain existing file is matched without converting the pattern + local files = os.files(path.join(tmpdir, "a[1]*.lua")) + t:are_equal(files, {path.join(tmpdir, "a[1].lua")}) + os.tryrm(tmpdir) +end |
