Sha256: d20e76f336abb87fec68f799229c901e9385835c60986ec046bf8f2017bfc2d6

Contents?: true

Size: 1.17 KB

Versions: 42

Compression:

Stored size: 1.17 KB

Contents

require 'test/unit'
LOADING_RUBY2_KEYWORDS = (RUBY_VERSION.scan(/\d+/).map(&:to_i) <=> [2, 7]) < 0
if LOADING_RUBY2_KEYWORDS
  require 'ruby2_keywords'
end

class TestKeywordArguments < Test::Unit::TestCase
  def test_loaded_features
    list = $LOADED_FEATURES.grep(%r[/ruby2_keywords\.rb\z])
    if LOADING_RUBY2_KEYWORDS
      assert_not_empty(list)
      assert_not_include($LOADED_FEATURES, "ruby2_keywords.rb")
    else
      assert_empty(list)
      assert_include($LOADED_FEATURES, "ruby2_keywords.rb")
    end
  end

  def test_module_ruby2_keywords
    assert_send([Module, :private_method_defined?, :ruby2_keywords])
    assert_operator(Module.instance_method(:ruby2_keywords).arity, :<, 0)
  end

  def test_toplevel_ruby2_keywords
    main = TOPLEVEL_BINDING.receiver
    assert_send([main, :respond_to?, :ruby2_keywords, true])
    assert_operator(main.method(:ruby2_keywords).arity, :<, 0)
  end

  def test_proc_ruby2_keywords
    assert_respond_to(Proc.new {}, :ruby2_keywords)
  end

  def test_hash_ruby2_keywords_hash?
    assert_false(Hash.ruby2_keywords_hash?({}))
  end

  def test_hash_ruby2_keywords_hash
    assert_equal({}, Hash.ruby2_keywords_hash({}.freeze))
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
shopify-cli-2.36.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.35.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.34.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.33.1 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.33.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.32.1 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.32.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.31.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.30.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.29.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.28.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.27.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.26.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.25.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.24.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.23.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.22.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.21.0 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.20.1 vendor/deps/ruby2_keywords/test/test_keyword.rb
shopify-cli-2.20.0 vendor/deps/ruby2_keywords/test/test_keyword.rb