Inconsistencies with MRI: `FrozenError (can't modify frozen array)` #5160
Milestone
Comments
@splattael did this happen to cause something to fail? We are happy to correct this (and this fix fixed a second issue), but did something fail due to the wrong string 'array'? |
@enebo Yay, thanks for fixing! Yes, it caused a test failure which matched the exact error message when using Dry::Struct::Value. It was something along these lines: require "dry/struct"
require "dry/types"
require "minitest/autorun"
class Image < Dry::Struct::Value
attribute :sizes, Array
end
class ImageTest < MiniTest::Test
def test_immutable
image = Image.new(sizes: %w[100x100])
e = assert_raises do
image.sizes << "200x200"
end
assert_equal "can't modify frozen Array", e.message
end
end On JRuby it failed with:
As a workaround we do: ...
assert_equal "can't modify frozen array", e.message.downcase
... Again, thanks for your blazing fast fix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
jruby -v
:jruby 9.2.0.0-SNAPSHOT (2.5.0) 2018-05-09 89183d0 OpenJDK 64-Bit Server VM 25.162-b12 on 1.8.0_162-8u162-b12-1~deb9u1-b12 [linux-x86_64]
uname -a
:Linux toshi 4.9.0-0.bpo.2-amd64 #1 SMP Debian 4.9.18-1~bpo8+1 (2017-04-10) x86_64 GNU/Linux
Given code
Expected Behavior
In MRI it's
Actual Behavior
Note the lowercase
array
.Possible references to other issues
The text was updated successfully, but these errors were encountered: