test/dollar_test.rb in openwferu-0.9.15 vs test/dollar_test.rb in openwferu-0.9.16
- old
+ new
@@ -20,12 +20,14 @@
#end
#def teardown
#end
- def test_one
+ def test_0
+
dict = {}
+
dict['renard'] = 'goupil'
dict['cane'] = 'oie'
dict['oie blanche'] = 'poule'
dotest("le petit renard", dict, "le petit renard")
@@ -49,31 +51,40 @@
dotest("""
""", dict, """
""")
end
- def test_two
+ def test_1
+
dict = {}
dict['x'] = 'y'
+
dotest("${x}", dict, "y")
dotest("\\${x}", dict, "\\${x}")
end
- def test_three
+ def test_2
+
dict = {}
dict['A'] = 'a'
dict['B'] = 'b'
dict['ab'] = 'ok'
+
dotest("${${A}${B}}", dict, "ok")
end
+ #def test_3
+ # assert_equal OpenWFE.unescape("toto and ${toto}"), "toto and ${toto}"
+ # assert_equal OpenWFE.unescape("toto & \${toto}"), "toto & ${toto}"
+ # assert_equal "toto & \\${toto}", "toto & ${toto}"
+ # #assert_equal OpenWFE.unescape('toto & \${toto}'), "toto & ${toto}"
+ #end
+
def dotest (text, dict, target)
result = OpenWFE::dsub(text, dict)
#puts "..>#{text}<"
#puts "...->"
#puts "..>#{result}<"
#puts
- assert \
- result == target,
- ">#{result}< != >#{target}<"
+ assert_equal result, target
end
end