-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
A Ruby library of mine, which provides refinements, was working as of JRuby 9.1.16.0. I recently added JRuby 9.2.0.0 and found that two tests which use refinements are now broken. Note all tests pass across all other Ruby versions, and I have not made any updates to the library.
1) Error:
RefinementsTest#test_xor:
NoMethodError: undefined method `xor' for "w\x12\xC5_\xD7\xB8\x06\xF3\xD4\x9Bl\x909\xF8(M":String
/home/travis/build/fny/xorcist/test/refinements_test.rb:10:in `test_xor'
2) Error:
RefinementsTest#test_xor_in_place:
NoMethodError: undefined method `xor!' for "String":String
/home/travis/build/fny/xorcist/test/refinements_test.rb:20:in `block in test_xor_in_place'
/home/travis/build/fny/xorcist/test/test_helper.rb:17:in `frozen_strings_dependent'
/home/travis/build/fny/xorcist/test/refinements_test.rb:19:in `test_xor_in_place'
Full trace available here:
https://travis-ci.org/fny/xorcist/jobs/418932838
I've included the relevant code below as a convenience:
# test/refinements_test.rb:
require 'test_helper'
if RUBY_ENGINE != 'rbx' && RUBY_VERSION >= '2.0.0'
require 'xorcist/refinements'
class RefinementsTest < Minitest::Test
using Xorcist::Refinements
def test_xor
assert_equal ZERO, X.xor(X)
assert_equal ONE, X.xor(INVX)
assert_equal X, X.xor(ZERO)
assert_equal INVX, X.xor(ONE)
end
def test_xor_in_place
a = "String"
b = a
frozen_strings_dependent {
b.xor!(X)
assert_equal(a, b)
}
end
end
end
# lib/xorcist/refinements.rb
require 'xorcist/string_methods'
module Xorcist
module Refinements
refine String do
include Xorcist::StringMethods
end
end
end
# lib/xorcist/string_methods.rb
module Xorcist
module StringMethods
def xor(other)
Xorcist.xor(self, other)
end
def xor!(other)
Xorcist.xor!(self, other)
end
end
endReactions are currently unavailable