Currently the limit is set to 40 bytes in #195, there are few issues with that:
-
Unpredictability. I discovered this trying to figure out why in some cases I don't get useful information during test failures, while in other cases I do. This is inconsistent
-
40 bytes is only useful when comparing numbers, for real use cases that will very often be not enough. Something like 400 bytes would suffice I guess
-
The initial argument
This avoids dumping enormous objects into the error message implicitly.
Does not make that much sense:
assert_eq doesn't have that limitation
ensure is used primarily in tests, having a bit of a spill there wouldn't hurt, while not getting useful information actually might hurt
So I wonder if this limit can be completely removed.
On the contrary, the difference with assert_eq is that with ensure the memory needs to be allocated, while with assert_eq it probably prints right away, so some limit probably makes sense for this reason
Currently the limit is set to 40 bytes in #195, there are few issues with that:
Unpredictability. I discovered this trying to figure out why in some cases I don't get useful information during test failures, while in other cases I do. This is inconsistent
40 bytes is only useful when comparing numbers, for real use cases that will very often be not enough. Something like 400 bytes would suffice I guess
The initial argument
Does not make that much sense:
assert_eqdoesn't have that limitationensureis used primarily in tests, having a bit of a spill there wouldn't hurt, while not getting useful information actually might hurtSo I wonder if this limit can be completely removed.
On the contrary, the difference with
assert_eqis that withensurethe memory needs to be allocated, while withassert_eqit probably prints right away, so some limit probably makes sense for this reason