-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
74 - Add diff renderer and improve reporting #113
Conversation
If @Vurv78 doesn't pick this up later today then I'll probably start a review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
local function isLuaSymbol(value) | ||
return type(value) == "string" | ||
and not KEYWORDS[value] | ||
and not not string.match(value, "^[_%a][_%a%d]*$") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm, this is a boolean coercion right? Looks sort of strange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, to avoid returning a non-boolean here
Issue
Resolves #74
Changes
prettyValue
intoserialiseValue
, which recursively prints tables that do not have an overriddentostring
renderDiff
function which is used to generate a diff between any two values, optionally performing a "deep" recursive diffprettyValue
to useserialiseValue
require
paths to remove the need forsrc.lua.
in everyrequire()
renderDiff
)expect
print to not serialise the values intoexpect(...).matcherName(...)
to avoid duplicating informationImpact
src.lua
manually, and automatically importingindex.lua
files when a directory path is givenTesting
Fairly well covered by automated tests, but should try the following:
toBe
failure messages display serialised expected and received with no table diff renderingtoEqual
failure messages matchtoBe
if one or both values are not a tabletoEqual
failure messages for two tables{1, 2, 3}
), symbol key ({foo = "bar"}
) or expression key ({["end"] = "bar"}
)never.toBe
andnever.toEqual
failure messages always show the serialised expected value in the formatExpected: not %s
Helpful Links
API Docs
Project Board
Discord