test/test_haskell.rb in haskell-0.0.2 vs test/test_haskell.rb in haskell-0.0.3
- old
+ new
@@ -19,16 +19,18 @@
assert_correct_type Numeric >= Numeric, [@numeric], @numeric
assert_correct_type Numeric >= Array, [@numeric], @array
assert_correct_type Numeric >= String, [@numeric], @string
assert_correct_type Numeric >= Hash, [@numeric], @hash
assert_correct_type Numeric >= Symbol, [@numeric], @symbol
+ assert_correct_type Numeric >= Boolean, [@numeric], true
+ assert_correct_type Numeric >= Boolean, [@numeric], false
- assert_correct_type Numeric >= Numeric >= Numeric, [@numeric, @numeric], @numeric
- assert_correct_type Numeric >= Array >= Array, [@numeric, @array ], @array
- assert_correct_type Numeric >= String >= String, [@numeric, @string ], @string
- assert_correct_type Numeric >= Hash >= Hash, [@numeric, @hash ], @hash
- assert_correct_type Numeric >= Symbol >= Symbol, [@numeric, @symbol ], @symbol
+ assert_correct_type Boolean >= Numeric >= Numeric, [true, @numeric], @numeric
+ assert_correct_type Boolean >= Array >= Array, [true, @array ], @array
+ assert_correct_type Boolean >= String >= String, [true, @string ], @string
+ assert_correct_type Boolean >= Hash >= Hash, [true, @hash ], @hash
+ assert_correct_type Boolean >= Symbol >= Symbol, [true, @symbol ], @symbol
end
def test_wrong_return_type
assert_wrong_rtn Numeric >= Numeric, [@numeric], @array
assert_wrong_rtn Numeric >= Numeric, [@numeric], @string
@@ -82,12 +84,13 @@
assert_raises(TypeError) { define_test_method(type_list, args, val).call(*args) }
end
def define_test_method(type_list, args, val)
klass = Class.new.class_eval <<-RUBY_CODE
- type #{obj_literal(type_list)}, def call(#{arg_literal(args.count)})
+ def call(#{arg_literal(args.count)})
#{obj_literal(val)}
end
+ type #{obj_literal(type_list)}, :call
RUBY_CODE
klass.new
end