push more responsibility down to node

expose simple attribute
write long or short
many test got more compact, good
This commit is contained in:
Torsten Ruger
2015-06-17 21:16:39 +03:00
parent 72fa26b00e
commit 78f0108166
10 changed files with 100 additions and 71 deletions

View File

@ -21,15 +21,15 @@ class BasicSof < MiniTest::Test
end
def test_array_array
@out = [true, 1 , [true , 12 ]]
check "- true\n- 1\n- [true, 12]"
check "[true, 1, [true, 12]]"
end
def test_array_array_reverse
@out = [ [true , 12 ], true, 1]
check "- [true, 12]\n- true\n- 1"
check "[[true, 12], true, 1]"
end
def test_array_array_array
@out = [true, 1 , [true , 12 , [true , 123 ]]]
check "- true\n- 1\n- - true\n - 12\n - [true, 123]"
check "[true, 1, [true, 12, [true, 123]]]"
end
def test_simple_hash
@out = { :one => 1 , :tru => true }
@ -37,7 +37,7 @@ class BasicSof < MiniTest::Test
end
def test_array_hash
@out = [true, 1 , { :one => 1 , :tru => true }]
check "- true\n- 1\n- {:one => 1, :tru => true}"
check "[true, 1, {:one => 1, :tru => true}]"
end
def test_array_recursive
ar = [true, 1 ]

View File

@ -11,7 +11,7 @@ class ObjectSof < MiniTest::Test
object = ObjectWithAttributes.new
object.extra = [:sym , 123]
@out = object
check "#{OBJECT_STRING}\n :extra [:sym, 123]"
check "ObjectWithAttributes(:name => 'some name', :number => 1234, :extra => [:sym, 123])"
end
def test_array_object
@out = [true, 1234 , ObjectWithAttributes.new]

View File

@ -14,30 +14,29 @@ class TestRefs < MiniTest::Test
def test_one_empty
@out = @array << @hash
check "- {}"
check "[{}]"
end
def test_two_empty
@out = @array << @hash
@out << @hash
check "- &1 {}
- ->1"
check "[&1 {}, ->1]"
end
def test_bigger
@out = [ { :one => @array , :two => [{ :three => @array}] } ]
check "- - :one => &1 []\n - :two => - {:three => ->1}"
check "[{:one => &1 [], :two => [{:three => ->1}]}]"
end
def test_object_ref
object = ObjectWithAttributes.new
object.extra = [object]
@out = [ {:one => object} , object ]
check "- {:one => ->1}\n- &1 #{OBJECT_STRING}\n :extra [->1]"
check "- {:one => ->1}\n- &1 ObjectWithAttributes(:name => 'some name', :number => 1234, :extra => [->1])"
end
def test_object_ref2
object = ObjectWithAttributes.new
object2 = ObjectWithAttributes.new
object.extra = [object2]
@out = [ {:one => object} , object2 ]
check "- - :one => #{OBJECT_STRING}\n :extra [->1]\n- &1 #{OBJECT_STRING}"
check "- - :one => ObjectWithAttributes(:name => 'some name', :number => 1234, :extra => [->1])\n- &1 ObjectWithAttributes(:name => 'some name', :number => 1234)"
end
end