Skip to content

Commit

Permalink
test: adjust lua-Harness test error assertion
Browse files Browse the repository at this point in the history
The current pattern in 303-package.t for the test case loading invalid
Lua script is too tight for the 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 the current working
  directory via "./" 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 common sense.
  • Loading branch information
igormunkin committed Dec 19, 2023
1 parent 2ab0419 commit 476e84b
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 476e84b

Please sign in to comment.