Sha256: 7315f4e1e92ce0397bbeed8e4e7316ff127f2bd1dfa06ce3587d01073851a2f4
Contents?: true
Size: 1.85 KB
Versions: 1
Compression:
Stored size: 1.85 KB
Contents
# # Testing OpenWFE # # John Mettraux at openwfe.org # # Mon Oct 9 22:19:44 JST 2006 # require 'test/unit' require 'openwfe/util/dollar' # # testing the 'dollar notation' # class DollarTest < Test::Unit::TestCase #def setup #end #def teardown #end def test_0 dict = {} dict['renard'] = 'goupil' dict['cane'] = 'oie' dict['oie blanche'] = 'poule' dotest("le petit renard", dict, "le petit renard") dotest("le petit {renard}", dict, "le petit {renard}") dotest("le petit ${renard}", dict, "le petit goupil") dotest("le petit ${renard} noir", dict, "le petit goupil noir") dotest("la grande ${${cane} blanche}", dict, "la grande poule") dotest("le ${renard} et la ${cane}", dict, "le goupil et la oie") # # excuse my french... dotest("le \\${renard} encore", dict, "le \\${renard} encore") dotest("", dict, "") dotest(""" """, dict, """ """) dotest(""" """, dict, """ """) end def test_1 dict = {} dict['x'] = 'y' dotest("${x}", dict, "y") dotest("\\${x}", dict, "\\${x}") end 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_equal result, target end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
openwferu-0.9.16 | test/dollar_test.rb |