require 'test/unit'
require 'spec_id'
require 'ostruct'
class Bob
include SpecIDXML
def initialize(first, second)
@first = first ; @second = second
end
end
class SpecIDXMLTest < Test::Unit::TestCase
include SpecIDXML
def initialize(*args)
super(*args)
end
def test_short_element_xml_from_instance_vars
obj = Bob.new(1, 2)
st = obj.short_element_xml_from_instance_vars("bob")
assert_match(/second="2"/, st)
assert_match(/first="1"/, st)
assert_match(/^$/, st)
end
def test_escape_special_chars
assert_equal("&><"'" , escape_special_chars("&><\"'"))
assert_equal("PE&PT>I<D"E'", escape_special_chars("PE&PT>I