Sha256: 0d8a80ac179e3a375de715d8598002b6fdda5327905c7e51bdfbf7971af034bd

Contents?: true

Size: 691 Bytes

Versions: 123

Compression:

Stored size: 691 Bytes

Contents

require 'test_helper'
require 'tins/xt/case_predicate'

module Tins
  class CasePredicateTest < Test::Unit::TestCase
    def test_case_predicate_failure
      assert_nil 4.case?(1, 2..3, 5...7)
    end

    def test_case_predicate_failure_is_a
      s = 'foo'
      assert_nil s.case?(Array, Hash)
      s = Class.new(String).new
      assert_nil s.case?(Array, Hash)
    end

    def test_case_predicate_success
      assert_equal 2..3, 3.case?(1, 2..3, 5...7)
    end

    def test_case_predicate_success_is_a
      s = 'foo'
      assert_equal String, s.case?(Array, Hash, String)
      s = Class.new(String).new
      assert_equal String, s.case?(Array, Hash, String)
    end
  end
end

Version data entries

123 entries across 109 versions & 8 rubygems

Version Path
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/tests/case_predicate_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/tests/case_predicate_test.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/tests/case_predicate_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/tests/case_predicate_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/tests/case_predicate_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/tests/case_predicate_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tins-1.26.0/tests/case_predicate_test.rb
tins-1.29.1 tests/case_predicate_test.rb
tins-1.29.0 tests/case_predicate_test.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/tests/case_predicate_test.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tins-1.26.0/tests/case_predicate_test.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/tests/case_predicate_test.rb
tins-1.28.0 tests/case_predicate_test.rb
tins-1.27.1 tests/case_predicate_test.rb
tins-1.27.0 tests/case_predicate_test.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/tests/case_predicate_test.rb
tins-1.26.0 tests/case_predicate_test.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/tins-1.25.0/tests/case_predicate_test.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/tins-1.25.0/tests/case_predicate_test.rb
tdiary-5.1.2 vendor/bundle/ruby/2.7.0/gems/tins-1.25.0/tests/case_predicate_test.rb