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
suzuko-0.1.8 vendor/bundle/ruby/2.0.0/gems/tins-1.6.0/tests/case_predicate_test.rb
suzuko-0.1.7 vendor/bundle/ruby/2.0.0/gems/tins-1.6.0/tests/case_predicate_test.rb
mastermind_adeybee-0.1.4 vendor/bundle/ruby/2.2.0/gems/tins-1.6.0/tests/case_predicate_test.rb
mastermind_adeybee-0.1.3 vendor/bundle/ruby/2.2.0/gems/tins-1.6.0/tests/case_predicate_test.rb
mastermind_adeybee-0.1.2 vendor/bundle/ruby/2.2.0/gems/tins-1.6.0/tests/case_predicate_test.rb
mastermind_adeybee-0.1.1 vendor/bundle/ruby/2.2.0/gems/tins-1.6.0/tests/case_predicate_test.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/tins-1.6.0/tests/case_predicate_test.rb
tins-1.6.0 tests/case_predicate_test.rb
tins-1.5.4 tests/case_predicate_test.rb
tins-1.5.3 tests/case_predicate_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/tins-1.5.2/tests/case_predicate_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/tins-1.5.1/tests/case_predicate_test.rb
tins-1.5.2 tests/case_predicate_test.rb
tins-1.5.1 tests/case_predicate_test.rb
tins-1.5.0 tests/case_predicate_test.rb
tins-1.4.2 tests/case_predicate_test.rb
tins-1.4.1 tests/case_predicate_test.rb
tins-1.4.0 tests/case_predicate_test.rb
tins-1.3.5 tests/case_predicate_test.rb
tins-1.3.4 tests/case_predicate_test.rb