Hacker News new | ask | show | jobs
by jlebrech 3277 days ago
they could just use a different interpreter, i.e disable some monkeypatching.
3 comments

I'm not sure disabling monkeypatching would suffice, couldn't you then just create your own type equal to everything and return that? I assume assert_equal just does `a == b` internally so `a` could be an AlwaysEqual instance rather than a monkeypatched nil.

A more sensible alternative would probably be to serialise the assert_equal parameters and check the results externally.

Adding negative tests (using `not a == b` to avoid the same monkeypatching of !=) would also help

They could just add a test that makes sure trivial comparisons still work.
sure that would work too :)
So is there no way to check the call stack and only "tweak" the result if you are being called from the verifier?

Or only return "true" on the 2nd call to the comparison?

Just some random ideas.

you mean sandbox the interpreter that the kata runs in? Extract the value and then de-serialise it for an equality check in another instance of the interpreter?