rx-file/test/test_basic.rb

49 lines
1018 B
Ruby
Raw Normal View History

require_relative "helper"
2017-09-27 14:35:55 +02:00
class BasicRxFile < MiniTest::Test
2015-05-15 19:59:33 +02:00
include Checker
def test_true
2015-05-15 20:03:11 +02:00
@out = true
2015-05-15 19:59:33 +02:00
check "true"
end
def test_string
2015-05-15 20:03:11 +02:00
@out = "true"
2015-05-15 19:59:33 +02:00
check "'true'"
end
def test_num
2015-05-15 20:03:11 +02:00
@out = 124
2015-05-15 19:59:33 +02:00
check "124"
end
def test_simple_array
2015-05-15 20:03:11 +02:00
@out = [true, 1234]
2015-05-15 19:59:33 +02:00
check "[true, 1234]"
end
def test_array_array
2015-05-15 20:03:11 +02:00
@out = [true, 1 , [true , 12 ]]
check "[true, 1, [true, 12]]"
end
def test_array_array_reverse
2015-05-15 20:03:11 +02:00
@out = [ [true , 12 ], true, 1]
check "[[true, 12], true, 1]"
end
def test_array_array_array
2015-05-15 20:03:11 +02:00
@out = [true, 1 , [true , 12 , [true , 123 ]]]
check "[true, 1, [true, 12, [true, 123]]]"
end
def test_simple_hash
2015-06-16 17:12:15 +02:00
@out = { :one => 1 , :tru => true }
2015-05-15 19:59:33 +02:00
check "{:one => 1, :tru => true}"
end
def test_array_hash
2015-06-16 17:12:15 +02:00
@out = [true, 1 , { :one => 1 , :tru => true }]
check "[true, 1, {:one => 1, :tru => true}]"
end
def test_array_recursive
ar = [true, 1 ]
ar << ar
2015-05-15 20:03:11 +02:00
@out = ar
2015-06-16 17:12:15 +02:00
check "&1 [true, 1, ->1]"
end
2015-05-15 19:59:33 +02:00
end