Skip to content

Commit

Permalink
test: adjust lua-Harness test error assertion
Browse files Browse the repository at this point in the history
Current pattern in 303-package.t for the test case loading invalid Lua
script is too tight for the two following reasons revealed by Tarantool
testing:
* The platform might prepend the common prefix to all Lua errors, so
  anchoring the pattern to the beginning of the error message is too
  strict for matching the particular errors
* The platform might canonicalize module names (i.e. use absolute paths)
  for searchers and loaders, so matching current working directory via
  as "./" is too straight forward

Hence this patch removes the starting anchor from the pattern and fixes
the last part of it to match only the "basename" of the module being
loaded. As a result the check is not too strict and Lua specific, but
rather starts following the common sense.
  • Loading branch information
igormunkin committed Dec 19, 2023
1 parent 2ab0419 commit 31005b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/lua-Harness-tests/303-package.t
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ return complex
f:write [[?syntax error?]]
f:close()
error_matches(function () require('syntax') end,
"^error loading module 'syntax' from file '%.[/\\]syntax%.lua':",
"error loading module 'syntax' from file '.+[/\\]syntax%.lua':",
"function require (syntax error)")
os.remove('syntax.lua') -- clean up

Expand Down

0 comments on commit 31005b3

Please sign in to comment.