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
Better list diffing2 #79
Conversation
# Conflicts: # luaunit.lua
-- line = line:sub(1,idxStart-1)..source..line:sub(idxEnd+1) | ||
-- string.gsub( line, dest, source ) | ||
if verbose then | ||
print('Result: '..line ) | ||
print('Result : '..line ) |
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.
That whitespace looks weird, is it really supposed to be there?
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.
Ah, I got it. It brings the line's prefix up to the same length as 'Modifying line: '
further up, for aligment / easier comparison.
@@ -1036,6 +1029,7 @@ local function _is_table_equals(actual, expected, recursions) | |||
return true | |||
end | |||
M.private._is_table_equals = _is_table_equals | |||
local is_equals = _is_table_equals |
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.
I'd prefer singular here in the function name, i.e. is_equal
.
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.
Why not...
When I use a local, it does not work. I get the following error message :
The spurious prints qre because I added the extra lines to debug the situation : lines 658-661 :
This is the is_equals which triggers the error. lines 1044-1047 :
|
The build fails because lua does not have the same representation of numbers on windows and linux... Annoying for test based on textual representations :-) |
Okay, I now see where the problem lies: Since your new routines are further up in the source code, this is a case of "use before declare" - leading to those errors. There are two possible solutions: Either a) move the entire local is_equals -- alias for _is_table_equals() function, gets assigned below near the top of the file (e.g. under "general utility functions"), and then do a simple Regards, NiteHawk |
We have encountered and worked around number formatting issues before, e.g. test/test_luaunit.lua#L1671-L1675. Maybe this would be a good opportunity to tackle the problem at the |
n1tehawk@e0d1d18 illustrates what I have in mind... |
…t when the alternate form "1.#INF" is used.
…n lua compiled with integer as a single precision float (as opposed to default double precision)
# Conflicts: # .luacheckrc
…al default already takes care of it
That's actually a good idea ! We can do it after merging in this branch. You want to take care of it ? Apart from that, any further comments on this branch ? |
Sure, I can do that.
Not really. I've noted a few smaller things here and there, but it's a bit hard to keep track of this PR in its entirety (as it needs some rebasing onto the current master by now). I think you should merge it first, if specific issues come up after that, we can still improve on / fix them later. If a more general luacheck is giving you troubles (makes you struggle with Lua syntax), I'll gladly help with that too. Regards, NiteHawk |
Cleaned up version of the list diff analysis