array with object
This commit is contained in:
parent
1415079659
commit
2d6a43cf0e
10
test/sof.rb
10
test/sof.rb
@ -6,6 +6,7 @@ class ObjectWithAttributes
|
|||||||
@number = 1234
|
@number = 1234
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
OBJECT_STRING = "ObjectWithAttributes(name: 'some object' ,number: 1234)"
|
||||||
|
|
||||||
class BasicSof < MiniTest::Test
|
class BasicSof < MiniTest::Test
|
||||||
def test_true
|
def test_true
|
||||||
@ -18,7 +19,7 @@ class BasicSof < MiniTest::Test
|
|||||||
end
|
end
|
||||||
def test_object
|
def test_object
|
||||||
out = Sof::Writer.write(ObjectWithAttributes.new)
|
out = Sof::Writer.write(ObjectWithAttributes.new)
|
||||||
assert_equal "ObjectWithAttributes(name: 'some object' ,number: 1234)\n" , out
|
assert_equal "#{OBJECT_STRING}\n" , out
|
||||||
end
|
end
|
||||||
def test_simple_array
|
def test_simple_array
|
||||||
out = Sof::Writer.write([true, 1234])
|
out = Sof::Writer.write([true, 1234])
|
||||||
@ -26,7 +27,7 @@ class BasicSof < MiniTest::Test
|
|||||||
end
|
end
|
||||||
def test_array_object
|
def test_array_object
|
||||||
out = Sof::Writer.write([true, 1234 , ObjectWithAttributes.new])
|
out = Sof::Writer.write([true, 1234 , ObjectWithAttributes.new])
|
||||||
assert_equal "-true\n-1234\n-ObjectWithAttributes(name: 'some object' ,number: 1234)\n\n" , out
|
assert_equal "-true\n-1234\n-#{OBJECT_STRING}\n\n" , out
|
||||||
end
|
end
|
||||||
def test_array_array
|
def test_array_array
|
||||||
out = Sof::Writer.write([true, 1 , [true , 12 ]])
|
out = Sof::Writer.write([true, 1 , [true , 12 ]])
|
||||||
@ -36,10 +37,9 @@ class BasicSof < MiniTest::Test
|
|||||||
out = Sof::Writer.write([true, 1 , [true , 12 , [true , 123 ]]])
|
out = Sof::Writer.write([true, 1 , [true , 12 , [true , 123 ]]])
|
||||||
assert_equal "-true\n-1\n--true\n -12\n --true\n -123\n\n\n" , out
|
assert_equal "-true\n-1\n--true\n -12\n --true\n -123\n\n\n" , out
|
||||||
end
|
end
|
||||||
def ttest_array_array_object
|
def test_array_array_object
|
||||||
out = Sof::Writer.write([true, 1 , [true , 12 , ObjectWithAttributes.new]])
|
out = Sof::Writer.write([true, 1 , [true , 12 , ObjectWithAttributes.new]])
|
||||||
# puts out
|
assert_equal "-true\n-1\n--true\n -12\n -#{OBJECT_STRING}\n\n\n" , out
|
||||||
assert_equal "-true\n-1234\n--true\n -12\n\n" , out
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
Loading…
x
Reference in New Issue
Block a user