Sha256: 1c1be6c05eaa5042b4e4d89ab0b7079fc51a726085bac07a05d64f36ae703904

Contents?: true

Size: 690 Bytes

Versions: 3

Compression:

Stored size: 690 Bytes

Contents

require 'test/unit'

class RubyCoreTest < Test::Unit::TestCase
  # Inherited classes should use separate variables
  def test_01
    eval <<EOL
class A
  class << self
    attr_accessor :foo
  end
end
class B < A; end
class C < B; end
EOL
    A.foo = 1
    B.foo = 2
    C.foo = 3
    assert_equal(1, A.foo)
    assert_equal(2, B.foo)
    assert_equal(3, C.foo)
  end

  # Test for Regression of Hash#reject in Ruby 2.1.1
  # https://www.ruby-lang.org/en/news/2014/03/10/regression-of-hash-reject-in-ruby-2-1-1/
  # Should pass in Ruby 2.0.0 and 2.1.2+ (not in 2.1.1)
  def test_02
    eval <<EOL
class SubHash < Hash; end
EOL
    assert_equal(SubHash, SubHash.new.reject{}.class)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alfa-0.0.8.pre test/test_ruby_core.rb
alfa-0.0.7.pre test/test_ruby_core.rb
alfa-0.0.6.pre test/test_ruby_core.rb