fix tests according to array change
This commit is contained in:
parent
1ee0f7c006
commit
7d01c1193c
@ -32,17 +32,17 @@ class BasicSof < MiniTest::Test
|
|||||||
check "- true\n- 1\n- - true\n - 12\n - [true, 123]"
|
check "- true\n- 1\n- - true\n - 12\n - [true, 123]"
|
||||||
end
|
end
|
||||||
def test_simple_hash
|
def test_simple_hash
|
||||||
@out = { one: 1 , tru: true }
|
@out = { :one => 1 , :tru => true }
|
||||||
check "{:one => 1, :tru => true}"
|
check "{:one => 1, :tru => true}"
|
||||||
end
|
end
|
||||||
def test_array_hash
|
def test_array_hash
|
||||||
@out = [true, 1 , { one: 1 , tru: true }]
|
@out = [true, 1 , { :one => 1 , :tru => true }]
|
||||||
check "- true\n- 1\n- {:one => 1, :tru => true}"
|
check "- true\n- 1\n- {:one => 1, :tru => true}"
|
||||||
end
|
end
|
||||||
def test_array_recursive
|
def test_array_recursive
|
||||||
ar = [true, 1 ]
|
ar = [true, 1 ]
|
||||||
ar << ar
|
ar << ar
|
||||||
@out = ar
|
@out = ar
|
||||||
check "&1 [true, 1, *1]"
|
check "&1 [true, 1, ->1]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -22,18 +22,18 @@ class ObjectSof < MiniTest::Test
|
|||||||
check "- true\n- 1\n- - true\n - 12\n - #{OBJECT_STRING}"
|
check "- true\n- 1\n- - true\n - 12\n - #{OBJECT_STRING}"
|
||||||
end
|
end
|
||||||
def test_hash_object
|
def test_hash_object
|
||||||
@out = { one: 1 , two: ObjectWithAttributes.new }
|
@out = { :one => 1 , :two => ObjectWithAttributes.new }
|
||||||
check "- :one => 1\n- :two => #{OBJECT_STRING}"
|
check "- :one => 1\n- :two => #{OBJECT_STRING}"
|
||||||
end
|
end
|
||||||
def test_hash_array
|
def test_hash_array
|
||||||
@out = { one: [1 , ObjectWithAttributes.new] , two: true }
|
@out = { :one => [1 , ObjectWithAttributes.new] , :two => true }
|
||||||
check "- :one => - 1\n - #{OBJECT_STRING}\n- :two => true"
|
check "- :one => - 1\n - #{OBJECT_STRING}\n- :two => true"
|
||||||
end
|
end
|
||||||
def test_object_recursive
|
def test_object_recursive
|
||||||
object = ObjectWithAttributes.new
|
object = ObjectWithAttributes.new
|
||||||
object.extra = object
|
object.extra = object
|
||||||
@out = object
|
@out = object
|
||||||
check "&1 ObjectWithAttributes(:name => 'some name', :number => 1234, :extra => *1)"
|
check "&1 ObjectWithAttributes(:name => 'some name', :number => 1234, :extra => ->1)"
|
||||||
end
|
end
|
||||||
def test_object_inline
|
def test_object_inline
|
||||||
object = ObjectWithAttributes.new
|
object = ObjectWithAttributes.new
|
||||||
@ -44,7 +44,7 @@ class ObjectSof < MiniTest::Test
|
|||||||
def test_volotile
|
def test_volotile
|
||||||
@out = ObjectWithAttributes.new
|
@out = ObjectWithAttributes.new
|
||||||
@out.volotile = 42
|
@out.volotile = 42
|
||||||
check "ObjectWithAttributes(:name => 'some name', :number => 1234)"
|
check "#{OBJECT_STRING}"
|
||||||
end
|
end
|
||||||
def test_class
|
def test_class
|
||||||
@out = ObjectWithAttributes
|
@out = ObjectWithAttributes
|
||||||
@ -55,6 +55,6 @@ class ObjectSof < MiniTest::Test
|
|||||||
object.extra = ObjectWithAttributes
|
object.extra = ObjectWithAttributes
|
||||||
ar = [object , ObjectWithAttributes]
|
ar = [object , ObjectWithAttributes]
|
||||||
@out = ar
|
@out = ar
|
||||||
check "-ObjectWithAttributes(:name => 'some name', :number => 1234, :extra => *1)\n-&1 ObjectWithAttributes"
|
check "- ObjectWithAttributes(:name => 'some name', :number => 1234, :extra => ->1)\n- &1 ObjectWithAttributes"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -20,16 +20,24 @@ class TestRefs < MiniTest::Test
|
|||||||
@out = @array << @hash
|
@out = @array << @hash
|
||||||
@out << @hash
|
@out << @hash
|
||||||
check "- &1 {}
|
check "- &1 {}
|
||||||
-*1"
|
- ->1"
|
||||||
end
|
end
|
||||||
def test_bigger
|
def test_bigger
|
||||||
@out = [ { :one => @array , :two => [{ :three => @array}] } ]
|
@out = [ { :one => @array , :two => [{ :three => @array}] } ]
|
||||||
check "--:one => &1 []\n -:two => -{:three => *1}"
|
check "- - :one => &1 []\n - :two => - {:three => ->1}"
|
||||||
end
|
end
|
||||||
def test_object
|
def test_object_ref
|
||||||
object = ObjectWithAttributes.new
|
object = ObjectWithAttributes.new
|
||||||
object.extra = [object]
|
object.extra = [object]
|
||||||
@out = [ {:one => object} , object ]
|
@out = [ {:one => object} , object ]
|
||||||
check "-{:one => *1}\n-&1 ObjectWithAttributes(:name => 'some name', :number => 1234)\n :extra [*1]"
|
check "- {:one => ->1}\n- &1 #{OBJECT_STRING}\n :extra [->1]"
|
||||||
end
|
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}"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user