-
Notifications
You must be signed in to change notification settings - Fork 59
Move all tests to ./tests/
with new Go module to isolate testing dependencies
#58
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
base: main
Are you sure you want to change the base?
Conversation
runTestWithCfg(t, name, &standardCfg, cases...) | ||
} | ||
|
||
func diffStrings(t *testing.T, expected, actual string) (*string, bool) { |
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.
To be clear, it was very intentional to use diff
here. assert.Equal()
produces super unreadable unified diffs. If you want different output, I'd be fine with an environment variable to control it (defaulting to diff
).
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.
Reverted, fwiw the pure go diff is a lot faster
tests/go.mod
Outdated
@@ -0,0 +1,16 @@ | |||
module github.com/sanity-io/litter/tests | |||
|
|||
go 1.23.7 |
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.
Might as well use latest (1.24.0?) and also update the root go.mod
?
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.
Updated in tests module, shouldn't update the main one unless necessary, libraries automatically get compiled with the version of their consumer, this is a minimum, and litter doesn't use any >1.16 features so I don't see why you'd break it for no reason
Summary
tests/
package, which is its own go module, to isolate testing dependencies from the main packageassert.Equal
instead of thediff
shellout, which may be uglier but is more reliable, was making a fuss about trailing newlines or something I didn't want to debug