Comments (9)
Btw, great package! I don't know how i lived without it before!
from assertions.
I like the idea. It definitely makes it feel better than ShouldResemble
.
from assertions.
ShouldResemble works fine for me, but perhaps ShouldEqual would be better since it is more intuitive for those that are new to the assertions package. Or perhaps the ShouldEqual could just detect if it is trying to be used on structs and print a message that redirects users to ShouldResemble.
from assertions.
The ShouldResemble
function sometimes fall over when comparing time values that are in different time zones. The .Equal()
method compares the actual instant, regardless of time zone, so that's why it's a compelling option.
from assertions.
I get "Equal" immediately. "Resemble" implies kind of equal? Perhaps in some circumstances? I'm sure i could look up the docs, but for something as basic as time.Time I just wrote my own assertion to make sure time is really equal.
from assertions.
Yes @rana, in retrospect, it probably just should have been ShouldDeepEqual
rather than ShouldResemble
. The word "resemble" doesn't have as strong a connotation as "equal". But I liked the definition, which referenced two things that have similar qualities/features (fields!):
re·sem·ble
rəˈzembəl
verb
have qualities or features, especially those of appearance, in common with (someone or something);
from assertions.
Sounds good!
from assertions.
You might find https://github.com/google/go-cmp useful for future works on the assertions package. Google created a new package for DeepEqual:
This package is intended to be a more powerful and safer alternative to reflect.DeepEqual for comparing whether two values are semantically equal.
Love the goconvey package, thanks for the awesome efforts!
from assertions.
Thanks for the tip @rana - I saw that recently (and now that I step back and think about it, that's probably where I got the idea to make use of the Equal method). I like that they are calling the Equal method from both directions to root out non-deterministic and/or non-symmetric scenarios (https://github.com/google/go-cmp/blob/master/cmp/compare.go#L369).
from assertions.
Related Issues (20)
- should.ContainKey fails for int32 key HOT 1
- Assertions should allow an optional string with a better message HOT 3
- ShouldEqualJSON only supports JSON Objects at the root HOT 1
- [suggestion] loose slice equality HOT 1
- ShouldBeEmpty should warn if subject has no length
- ShouldEqualJSON does not work with json arrays HOT 4
- Problem running test HOT 1
- httptest.NewServer starts in background goroutine and causes data race when used with shouldNotBeNil (which depends upon string formatting) HOT 3
- Golang 1.16 beta 1: TestMapSortRendering fails on s390x HOT 7
- building error HOT 2
- Drop go1.17 dependency HOT 2
- Super small typo in documentation of ShouldNotBeBlank
- Versioning scheme changed backwards HOT 3
- TestMapSortRendering fails with go1.18 HOT 1
- map[int64]bool ShouldContainKey didn't work as expected HOT 4
- No function for comparing arrays and ignoring order HOT 4
- ShouldResemble can fail when there's no visual diff between the inputs HOT 1
- The module declares is incorrect HOT 2
- ShouldEqual no longer works with functions HOT 5
- Major version shall be bumped since v1.51.0 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from assertions.