From dedb4b3e9f13ae75c0ccd1eb77605143ae1a8fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Sat, 28 Feb 2026 12:18:01 +0100 Subject: [PATCH] fix(tests): be more relaxed in testing pathnames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The path in my case is in fact versioned, so the test fails with Failure -> spec/fixtures_spec.lua @ 7 fixtures: path() returns the absolute fixture path spec/fixtures_spec.lua:9: Expected strings to match. Passed in: (string) '/home/abuild/rpmbuild/BUILD/lua55-busted-2.3.0-build/busted-2.3.0/spec/fixtures/myfile.txt' Expected: (string) '^.-busted[/\]spec[/\]fixtures[/\]myfile.txt$' stack traceback: spec/fixtures_spec.lua:9: in function Failure -> spec/fixtures_spec.lua @ 12 fixtures: path() returns the absolute fixture path normalized spec/fixtures_spec.lua:14: Expected strings to match. Passed in: (string) '/home/abuild/rpmbuild/BUILD/lua55-busted-2.3.0-build/busted-2.3.0/fixtures/myfile.txt' Expected: (string) '^.-busted[/\]fixtures[/\]myfile.txt$' stack traceback: spec/fixtures_spec.lua:14: in function Fixes: https://github.com/lunarmodules/busted/issues/768 Signed-off-by: Matěj Cepl --- spec/fixtures_spec.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/fixtures_spec.lua b/spec/fixtures_spec.lua index a42f149f..cd12c647 100644 --- a/spec/fixtures_spec.lua +++ b/spec/fixtures_spec.lua @@ -6,12 +6,12 @@ describe("fixtures:", function() it("returns the absolute fixture path", function() local path = fixtures.path("fixtures/myfile.txt") - assert.match("^.-busted[/\\]spec[/\\]fixtures[/\\]myfile.txt$", path) + assert.match("^.-busted[^/\\]*[/\\]spec[/\\]fixtures[/\\]myfile.txt$", path) end) it("returns the absolute fixture path normalized", function() local path = fixtures.path("../fixtures/myfile.txt") - assert.match("^.-busted[/\\]fixtures[/\\]myfile.txt$", path) + assert.match("^.-busted[^/\\]*[/\\]fixtures[/\\]myfile.txt$", path) end) it("errors on bad input", function() @@ -83,4 +83,3 @@ describe("fixtures:", function() end) -