-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Single vs double spaced output #68
Comments
Hey @mattharrigan do you have an example of a test where you're seeing this inconsistency? Sorry for not replying sooner, the GitHub notification for this is showing as 6 hours ago 🤔 |
Hey @bradleyjkemp, I'm getting the same issue. The snapshot output for all tests seem to change from single / double spaces at random. --- FAIL: Test_Repository/get_opening_hours (0.00s)
client_test.go:223: snapshot not equal:
--- Previous
+++ Current
@@ -1,2 +1,2 @@
-(*api.GetOpeningHoursSpecificationResponse)(specification:{dayOfWeek:2 opens:"11:00" closes:"22:00" validFrom:"3000-11-01T00:00:00Z" validThrough:"3000-12-01T00:00:00Z"})
+(*api.GetOpeningHoursSpecificationResponse)(specification:{dayOfWeek:2 opens:"11:00" closes:"22:00" validFrom:"3000-11-01T00:00:00Z" validThrough:"3000-12-01T00:00:00Z"}) {
name: "get opening hours",
test: func(t *testing.T) {
ctx := context.Background()
hours, err := repository.GetOpeningHoursSpecification(ctx, &api.GetOpeningHoursSpecificationRequest{
VenueId: UUID,
Date: "3000-11-11T00:00:00Z",
})
require.NoError(t, err)
cupaloy.SnapshotT(t, hours)
},
}, |
Ah are you using protobuf by any chance? The default protobuf Cupaloy shouldn't really be using the String() method by default but it'd be a breaking change to disable the behaviour. Cupaloy should probably have an option to disable this though. |
thanks @bradleyjkemp 👍 , didn't know about that protobuf behaviour |
cupaloy.New(cupaloy.UseStringerMethods(false)).SnapshotT(t, hours) |
Ah awesome there already is an option for disabling |
I am getting inconsistent test failures. The difference is sometimes there are single spaces in the snapshot of a variable, and sometimes there are double spaces. Any ideas on why or how to fix? Thanks.
From
go.sum
The text was updated successfully, but these errors were encountered: