summaryrefslogtreecommitdiff
path: root/test/xsd
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-28 09:29:07 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-28 09:29:07 +0000
commitd57fc5a48922bbdcc6ab8dc0c2e02fe796c70afc (patch)
tree4b8b4badc2992575205492d70e99dd09f72ce3e7 /test/xsd
parent1e14eb61c9fad7030def09fc4df37da1da0f50b9 (diff)
* lib/xsd/charset.rb: XSD::Charset.is_ces did return always true under
$KCODE = "NONE" environment. check added. * test/xsd/test_xsd.rb: add tests for above fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/xsd')
-rw-r--r--test/xsd/test_xsd.rb27
1 files changed, 24 insertions, 3 deletions
diff --git a/test/xsd/test_xsd.rb b/test/xsd/test_xsd.rb
index bbcbc9c778..818ad51988 100644
--- a/test/xsd/test_xsd.rb
+++ b/test/xsd/test_xsd.rb
@@ -7,11 +7,9 @@ module XSD
class TestXSD < Test::Unit::TestCase
def setup
- # Nothing to do.
end
def teardown
- # Nothing to do.
end
def assert_parsed_result(klass, str)
@@ -48,7 +46,7 @@ class TestXSD < Test::Unit::TestCase
assert_equal('var', o.to_s)
end
- def test_XSDString
+ def test_XSDString_UTF8
o = XSD::XSDString.new
assert_equal(XSD::Namespace, o.type.namespace)
assert_equal(XSD::StringLiteral, o.type.name)
@@ -66,6 +64,29 @@ class TestXSD < Test::Unit::TestCase
end
end
+ def test_XSDString_NONE
+ XSD::Charset.module_eval { @encoding_backup = @encoding; @encoding = "NONE" }
+ begin
+ o = XSD::XSDString.new
+ assert_equal(XSD::Namespace, o.type.namespace)
+ assert_equal(XSD::StringLiteral, o.type.name)
+ assert_equal(nil, o.data)
+ assert_equal(true, o.is_nil)
+
+ str = "abc"
+ assert_equal(str, XSD::XSDString.new(str).data)
+ assert_equal(str, XSD::XSDString.new(str).to_s)
+ assert_raises(XSD::ValueSpaceError) do
+ XSD::XSDString.new("\0")
+ end
+ assert_raises(XSD::ValueSpaceError) do
+ p XSD::XSDString.new("\xC0\xC0").to_s
+ end
+ ensure
+ XSD::Charset.module_eval { @encoding = @encoding_backup }
+ end
+ end
+
def test_XSDBoolean
o = XSD::XSDBoolean.new
assert_equal(XSD::Namespace, o.type.namespace)