require 'test/unit' require 'htree/gencode' require 'htree/parse' class TestGenCode < Test::Unit::TestCase def run_code(code, top_context) out = HTree::Encoder.new(HTree::Encoder.internal_charset, HTree::Encoder.internal_charset) eval(code) out.finish end def test_xmlns t = HTree.parse_xml('bb').children[0].children[0] # bb code = t.generate_xml_output_code assert_equal("bb", run_code(code, HTree::DefaultContext)) assert_equal("bb", run_code(code, HTree::DefaultContext.subst_namespaces("p"=>"z"))) end def test_xmlns_chref t = HTree.parse_xml('').children[0] code = t.generate_xml_output_code assert_equal("", run_code(code, HTree::DefaultContext)) end end