Module: UnionTest
- Defined in:
- lib/type_struct/union_test.rb
Constant Summary collapse
- U =
Union.new(TrueClass, FalseClass)
Instance Method Summary collapse
- #test_class_or(t) ⇒ Object
- #test_class_or_is_undefined(t) ⇒ Object
- #test_equal(t) ⇒ Object
- #test_or(t) ⇒ Object
- #test_union(t) ⇒ Object
Instance Method Details
#test_class_or(t) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/type_struct/union_test.rb', line 46 def test_class_or(t) u = TrueClass | FalseClass unless u === true t.error("error") end end |
#test_class_or_is_undefined(t) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/type_struct/union_test.rb', line 37 def test_class_or_is_undefined(t) TrueClass | FalseClass rescue NoMethodError else t.error("refinents miss") end |
#test_equal(t) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/type_struct/union_test.rb', line 25 def test_equal(t) unless U === true t.error("union error") end unless U === false t.error("union error") end if U === nil t.error("union error") end end |