-
Notifications
You must be signed in to change notification settings - Fork 105
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
Add Object support for compare_deep() #662
Comments
This seems out of scope for If you only have two objects you want to compare you might be able to use If I'm misunderstanding the request, add some sample code. |
That's a good point. I didn't think of trying I wrote some functions to use in a GutTest (link below) where I needed to compare objects & arrays/dictionaries possibly containing objects, so that'd be a good sample of why I needed it. The initial code I had written didn't really isolate what failed the comparison so that's why I recursively return a string, and concatenate it back up that recursive chain until it's printed as 1 string containing all the info I need to see what failed. May be something to consider if it's decided to implement this https://github.com/neth392/godot-improved-json/blob/main/tests/test_custom_objects.gd#L160 |
There are problems with this implementation but if anyone wants a quick and dirty approach: USE WITH CAUTION!!!! (I haven't tested)
Maybe it'd be best to first check for an Also, I haven't tested this too deeply. So, I don't know how well the recursiveness works. EDIT: I cleaned up the code a bit and added the |
Versions
What versions of Godot do you want to use this feature in?
Latest
The Feature
I am writing tests for a serialization library. The tests involve comparing original object instances to their deserialized counterparts. Godot's == does not work with this as the objects are two different instances, but I need to test to see if their property values match. If compare_deep supported objects this would be great, as right now I have to write some really hacky code to make these tests work & be verbose enough to isolate which properties do not match. Recursive support would be needed too as objects can have properties whose values are other objects
The text was updated successfully, but these errors were encountered: