test for array with array

This commit is contained in:
Torsten Ruger 2014-08-15 15:04:13 +03:00
parent 198e70b6bd
commit 716bc93e4a
2 changed files with 6 additions and 2 deletions

View File

@ -1,7 +1,7 @@
Array.class_eval do
def to_sof(io , members , level)
each do |object|
io.write(" " * level)
each_with_index do |object , i|
io.write(" " * level) unless i == 0
io.write("-")
members.output(io , object)
io.write("\n")

View File

@ -28,5 +28,9 @@ class BasicSof < MiniTest::Test
out = Sof::Writer.write([true, 1234 , ObjectWithAttributes.new])
assert_equal "-true\n-1234\n-ObjectWithAttributes(name: 'some object' ,number: 1234)\n\n" , out
end
def test_array_with_array
out = Sof::Writer.write([true, 1234 , [true , 12 ]])
assert_equal "-true\n-1234\n--true\n -12\n\n" , out
end
end