Uh oh!
There was an error while loading. Please reload this page.
[Ruby 2.5] String#-@ - #586
Conversation
5298be9 to
dda2047Compare| it "returns the same object when it's called on the same String literal" do | ||
| (-"unfrozen string").should equal(-"unfrozen string") | ||
| end |
There was a problem hiding this comment.
Maybe an extra spec to make sure it returns a different object for different strings? :D
There was a problem hiding this comment.
@eregon Done.
The features aren't described clearly in the tickets (IMHO) and I haven't found any related tests in the ruby/ruby git repository. So without diving into source code I cannot say these specs are comprehensive
| it "returns the same object for equal unfrozen strings" do | ||
| origin = -"this string is frozen" | ||
| dynamic = -%w(this string is frozen).join(' ') | ||
There was a problem hiding this comment.
It would be interesting to not call -@ on the dynamic part and first check origin.should_not equal dynamic.
Then (-dynamic).should equal origin.
eregon
commented
Jan 26, 2018
I think so, unless it's specifically an object_id spec. The object_id check might be a bit stronger though as |
c914fbf to
bca5946Compareeregon
commented
Jan 27, 2018
Thanks for the new spec! |
eregon
commented
Jan 27, 2018
I added an extra example for frozen strings in a2fd7c4. |
Done:
Issue #565