Module: ArrayOfTest
- Defined in:
- lib/type_struct/array_of_test.rb
Instance Method Summary collapse
Instance Method Details
#test_equal(t) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/type_struct/array_of_test.rb', line 10 def test_equal(t) int = ArrayOf.new(Integer) str = ArrayOf.new(String) unless int === [] t.error("empty array check was failed") end unless int === [1, 2, 3] t.error("array of integer check was failed") end unless str === %w(foo bar baz) t.error("array of string check was failed") end if str === [1, 2, 3] t.error("array of integer is not string") end end |
#test_initialize(t) ⇒ Object
4 5 6 7 8 |
# File 'lib/type_struct/array_of_test.rb', line 4 def test_initialize(t) unless ArrayOf === ArrayOf.new(Integer) t.error("failed when array of integer") end end |
#test_to_s(t) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/type_struct/array_of_test.rb', line 31 def test_to_s(t) array_of = ArrayOf.new(Symbol) expect = "TypeStruct::ArrayOf(Symbol)" unless expect == array_of.to_s t.error("to_s string was break #{expect} != #{array_of}") end end |