Use ~= operator in TestStore #1846
Replies: 1 comment
-
Hi @andreweades, I'm not sure I fully understand. Are you saying you want to be able to use If so, I would highly recommend against that. It is completely possible for two distinct values to be "equal", save for the Now, having said that, if you truly, truly do want to go down this road (and again I highly recommend against it 🙂), then it seems you could create a kind of Or, maybe I've completely misunderstand your concerns. If so, could you share some code to make things more concrete? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I use UUID and other types of ID a lot and I often wish that I could maintain that without having to have a special test version. I feel that I'm not really testing things as "real world" as I would like for the sake of State being Equatable.
How about a TestEquatable protocol that uses ~= or can be switched between == and ~= then it would be trivial to separate out. At the moment I have to override == to ignore ID which I'm still a little unsure about whether that will come back to bite me.
The new decency stuff makes this less of a problem for UUID but I still find that I'm creating structs of "equal" things but with unique IDs in my code.
Beta Was this translation helpful? Give feedback.
All reactions