diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-27 13:10:55 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-27 13:10:55 +0000 |
commit | ba3d2f4ac20bec871fe96a393d923d0cbb0fd96a (patch) | |
tree | 897a0308607db1dad21eef1fee86b351e93ebfa5 /test/rexml/test_validation_rng.rb | |
parent | 313fa180333a1eb4d1fa1542930e83f8d77e6b2d (diff) |
* test/rexml/test_contrib.rb: Indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml/test_validation_rng.rb')
-rw-r--r-- | test/rexml/test_validation_rng.rb | 616 |
1 files changed, 308 insertions, 308 deletions
diff --git a/test/rexml/test_validation_rng.rb b/test/rexml/test_validation_rng.rb index 67abe20a48..8989fe2cbf 100644 --- a/test/rexml/test_validation_rng.rb +++ b/test/rexml/test_validation_rng.rb @@ -4,11 +4,11 @@ require "rexml/document" require "rexml/validation/relaxng" module REXMLTests -class RNGValidation < Test::Unit::TestCase - include REXML + class RNGValidation < Test::Unit::TestCase + include REXML - def test_validate - rng = %q{ + def test_validate + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"> @@ -25,16 +25,16 @@ class RNGValidation < Test::Unit::TestCase </element> </element> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - no_error( validator, %q{<A><B><C X="x"><E/><E/></C><D/></B></A>} ) - error( validator, %q{<A><B><D/><C X="x"/></B></A>} ) - end + no_error( validator, %q{<A><B><C X="x"><E/><E/></C><D/></B></A>} ) + error( validator, %q{<A><B><D/><C X="x"/></B></A>} ) + end - def test_sequence - rng = %q{ + def test_sequence + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"> @@ -46,18 +46,18 @@ class RNGValidation < Test::Unit::TestCase </element> </element> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B><C/><C/><D/></B></A>} ) - error( validator, %q{<A><B><D/><C/></B></A>} ) - error( validator, %q{<A><C/><D/></A>} ) - no_error( validator, %q{<A><B><C/><D/></B></A>} ) - end + error( validator, %q{<A><B><C/><C/><D/></B></A>} ) + error( validator, %q{<A><B><D/><C/></B></A>} ) + error( validator, %q{<A><C/><D/></A>} ) + no_error( validator, %q{<A><B><C/><D/></B></A>} ) + end - def test_choice - rng = %q{ + def test_choice + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"> @@ -71,16 +71,16 @@ class RNGValidation < Test::Unit::TestCase </choice> </element> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B><C/><D/></B></A>} ) - no_error( validator, %q{<A><B><D/></B></A>} ) - no_error( validator, %q{<A><B><C/></B></A>} ) - end + error( validator, %q{<A><B><C/><D/></B></A>} ) + no_error( validator, %q{<A><B><D/></B></A>} ) + no_error( validator, %q{<A><B><C/></B></A>} ) + end - def test_optional - rng = %q{ + def test_optional + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"> @@ -91,17 +91,17 @@ class RNGValidation < Test::Unit::TestCase </optional> </element> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - no_error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A><B><C/></B></A>} ) - error( validator, %q{<A><B><D/></B></A>} ) - error( validator, %q{<A><B><C/><C/></B></A>} ) - end + no_error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A><B><C/></B></A>} ) + error( validator, %q{<A><B><D/></B></A>} ) + error( validator, %q{<A><B><C/><C/></B></A>} ) + end - def test_zero_or_more - rng = %q{ + def test_zero_or_more + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"> @@ -112,15 +112,15 @@ class RNGValidation < Test::Unit::TestCase </zeroOrMore> </element> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) - no_error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A><B><C/></B></A>} ) - no_error( validator, %q{<A><B><C/><C/><C/></B></A>} ) - error( validator, %q{<A><B><D/></B></A>} ) - error( validator, %q{<A></A>} ) + } + validator = REXML::Validation::RelaxNG.new( rng ) + no_error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A><B><C/></B></A>} ) + no_error( validator, %q{<A><B><C/><C/><C/></B></A>} ) + error( validator, %q{<A><B><D/></B></A>} ) + error( validator, %q{<A></A>} ) - rng = %q{ + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"> @@ -134,17 +134,17 @@ class RNGValidation < Test::Unit::TestCase </zeroOrMore> </element> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - no_error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A><B><C/><D/></B></A>} ) - no_error( validator, %q{<A><B><C/><D/><C/><D/></B></A>} ) - error( validator, %q{<A><B><D/></B></A>} ) - end + no_error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A><B><C/><D/></B></A>} ) + no_error( validator, %q{<A><B><C/><D/><C/><D/></B></A>} ) + error( validator, %q{<A><B><D/></B></A>} ) + end - def test_one_or_more - rng = %q{ + def test_one_or_more + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"> @@ -155,34 +155,34 @@ class RNGValidation < Test::Unit::TestCase </oneOrMore> </element> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A><B><C/></B></A>} ) - no_error( validator, %q{<A><B><C/><C/><C/></B></A>} ) - error( validator, %q{<A><B><D/></B></A>} ) - error( validator, %q{<A></A>} ) - end + } + validator = REXML::Validation::RelaxNG.new( rng ) + + error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A><B><C/></B></A>} ) + no_error( validator, %q{<A><B><C/><C/><C/></B></A>} ) + error( validator, %q{<A><B><D/></B></A>} ) + error( validator, %q{<A></A>} ) + end - def test_attribute - rng = %q{ + def test_attribute + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <attribute name="X"/> <attribute name="Y"/> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/></A>} ) - error( validator, %q{<A/>} ) - error( validator, %q{<A X=""/>} ) - no_error( validator, %q{<A X="1" Y="1"/>} ) - end + error( validator, %q{<A><B/></A>} ) + error( validator, %q{<A/>} ) + error( validator, %q{<A X=""/>} ) + no_error( validator, %q{<A X="1" Y="1"/>} ) + end - def test_choice_attributes - rng = %q{ + def test_choice_attributes + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <choice> @@ -190,17 +190,17 @@ class RNGValidation < Test::Unit::TestCase <attribute name="Y"/> </choice> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A X="1" Y="1"/>} ) - error( validator, %q{<A/>} ) - no_error( validator, %q{<A X="1"/>}) - no_error( validator, %q{<A Y="1"/>} ) - end + error( validator, %q{<A X="1" Y="1"/>} ) + error( validator, %q{<A/>} ) + no_error( validator, %q{<A X="1"/>}) + no_error( validator, %q{<A Y="1"/>} ) + end - def test_choice_attribute_element - rng = %q{ + def test_choice_attribute_element + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <choice> @@ -208,45 +208,45 @@ class RNGValidation < Test::Unit::TestCase <element name="B"/> </choice> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A X="1"><B/></A>} ) - error( validator, %q{<A/>} ) - no_error( validator, %q{<A X="1"/>}) - no_error( validator, %q{<A><B/></A>} ) - end + error( validator, %q{<A X="1"><B/></A>} ) + error( validator, %q{<A/>} ) + no_error( validator, %q{<A X="1"/>}) + no_error( validator, %q{<A><B/></A>} ) + end - def test_empty - rng = %q{ + def test_empty + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <empty/> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/></A>} ) - error( validator, %q{<A>Text</A>} ) - no_error( validator, %q{<A/>}) - end + error( validator, %q{<A><B/></A>} ) + error( validator, %q{<A>Text</A>} ) + no_error( validator, %q{<A/>}) + end - def test_text_val - rng = %q{ + def test_text_val + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <text/> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A>Text</A>} ) - error( validator, %q{<A/>}) - end + error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A>Text</A>} ) + error( validator, %q{<A/>}) + end - def test_choice_text - rng = %q{ + def test_choice_text + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <choice> @@ -254,17 +254,17 @@ class RNGValidation < Test::Unit::TestCase <text/> </choice> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/>Text</A>} ) - error( validator, %q{<A>Text<B/></A>} ) - no_error( validator, %q{<A>Text</A>} ) - no_error( validator, %q{<A><B/></A>} ) - end + error( validator, %q{<A><B/>Text</A>} ) + error( validator, %q{<A>Text<B/></A>} ) + no_error( validator, %q{<A>Text</A>} ) + no_error( validator, %q{<A><B/></A>} ) + end - def test_group - rng = %q{ + def test_group + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <choice> @@ -275,15 +275,15 @@ class RNGValidation < Test::Unit::TestCase </group> </choice> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/><C/></A>} ) - error( validator, %q{<A><C/></A>} ) - no_error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A><C/><D/></A>} ) + error( validator, %q{<A><B/><C/></A>} ) + error( validator, %q{<A><C/></A>} ) + no_error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A><C/><D/></A>} ) - rng = %q{ + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"/> @@ -292,33 +292,33 @@ class RNGValidation < Test::Unit::TestCase <element name="D"/> </group> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/><C/></A>} ) - error( validator, %q{<A><B/><D/></A>} ) - error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A><B/><C/><D/></A>} ) - end + error( validator, %q{<A><B/><C/></A>} ) + error( validator, %q{<A><B/><D/></A>} ) + error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A><B/><C/><D/></A>} ) + end - def test_value - # Values as text nodes - rng = %q{ + def test_value + # Values as text nodes + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"> <value>VaLuE</value> </element> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B>X</B></A>} ) - error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A><B>VaLuE</B></A>} ) + error( validator, %q{<A><B>X</B></A>} ) + error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A><B>VaLuE</B></A>} ) - # Values as text nodes, via choice - rng = %q{ + # Values as text nodes, via choice + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"> @@ -328,32 +328,32 @@ class RNGValidation < Test::Unit::TestCase </choice> </element> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/></A>} ) - error( validator, %q{<A><B>XYZ</B></A>} ) - no_error( validator, %q{<A><B>Option 1</B></A>} ) - no_error( validator, %q{<A><B>Option 2</B></A>} ) + error( validator, %q{<A><B/></A>} ) + error( validator, %q{<A><B>XYZ</B></A>} ) + no_error( validator, %q{<A><B>Option 1</B></A>} ) + no_error( validator, %q{<A><B>Option 2</B></A>} ) - # Attribute values - rng = %q{ + # Attribute values + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <attribute name="B"> <value>VaLuE</value> </attribute> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A/>} ) - error( validator, %q{<A B=""/>} ) - error( validator, %q{<A B="Lala"/>} ) - no_error( validator, %q{<A B="VaLuE"/>} ) + error( validator, %q{<A/>} ) + error( validator, %q{<A B=""/>} ) + error( validator, %q{<A B="Lala"/>} ) + no_error( validator, %q{<A B="VaLuE"/>} ) - # Attribute values via choice - rng = %q{ + # Attribute values via choice + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <attribute name="B"> @@ -363,17 +363,17 @@ class RNGValidation < Test::Unit::TestCase </choice> </attribute> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A B=""/>} ) - error( validator, %q{<A B="Value"/>} ) - no_error( validator, %q{<A B="Option 1"></A>} ) - no_error( validator, %q{<A B="Option 2"/>} ) - end + error( validator, %q{<A B=""/>} ) + error( validator, %q{<A B="Value"/>} ) + no_error( validator, %q{<A B="Option 1"></A>} ) + no_error( validator, %q{<A B="Option 2"/>} ) + end - def test_interleave - rng = %q{ + def test_interleave + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"> @@ -384,20 +384,20 @@ class RNGValidation < Test::Unit::TestCase </interleave> </element> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{<A><B><C/></B></A>} ) - error( validator, %q{<A><B><C/><D/><C/></B></A>} ) - no_error( validator, %q{<A><B><C/><D/><E/></B></A>} ) - no_error( validator, %q{<A><B><E/><D/><C/></B></A>} ) - no_error( validator, %q{<A><B><D/><C/><E/></B></A>} ) - no_error( validator, %q{<A><B><E/><C/><D/></B></A>} ) - error( validator, %q{<A><B><E/><C/><D/><C/></B></A>} ) - end + } + validator = REXML::Validation::RelaxNG.new( rng ) - def test_mixed - rng = %q{ + error( validator, %q{<A><B><C/></B></A>} ) + error( validator, %q{<A><B><C/><D/><C/></B></A>} ) + no_error( validator, %q{<A><B><C/><D/><E/></B></A>} ) + no_error( validator, %q{<A><B><E/><D/><C/></B></A>} ) + no_error( validator, %q{<A><B><D/><C/><E/></B></A>} ) + no_error( validator, %q{<A><B><E/><C/><D/></B></A>} ) + error( validator, %q{<A><B><E/><C/><D/><C/></B></A>} ) + end + + def test_mixed + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <element name="A" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="B"> @@ -406,15 +406,15 @@ class RNGValidation < Test::Unit::TestCase </mixed> </element> </element> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - no_error( validator, %q{<A><B>Text<D/></B></A>} ) - no_error( validator, %q{<A><B><D/>Text</B></A>} ) - end + no_error( validator, %q{<A><B>Text<D/></B></A>} ) + no_error( validator, %q{<A><B><D/>Text</B></A>} ) + end - def test_ref_sequence - rng = %q{ + def test_ref_sequence + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -430,15 +430,15 @@ class RNGValidation < Test::Unit::TestCase </element> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - no_error( validator, %q{<A><B X=''/><B X=''/></A>} ) - error( validator, %q{<A><B X=''/></A>} ) - end + no_error( validator, %q{<A><B X=''/><B X=''/></A>} ) + error( validator, %q{<A><B X=''/></A>} ) + end - def test_ref_choice - rng = %q{ + def test_ref_choice + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -454,15 +454,15 @@ class RNGValidation < Test::Unit::TestCase <element name="C"/> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><D/></A>} ) - error( validator, %q{<A><B/><C/></A>} ) - no_error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A><C/></A>} ) + error( validator, %q{<A><D/></A>} ) + error( validator, %q{<A><B/><C/></A>} ) + no_error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A><C/></A>} ) - rng = %q{ + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -478,15 +478,15 @@ class RNGValidation < Test::Unit::TestCase </choice> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><D/></A>} ) - error( validator, %q{<A><B/><C/></A>} ) - no_error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A><C/></A>} ) + error( validator, %q{<A><D/></A>} ) + error( validator, %q{<A><B/><C/></A>} ) + no_error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A><C/></A>} ) - rng = %q{ + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -503,18 +503,18 @@ class RNGValidation < Test::Unit::TestCase <element name="C"/> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/><C/></A>} ) - no_error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A><C/></A>} ) - no_error( validator, %q{<A><D/></A>} ) - end + error( validator, %q{<A><B/><C/></A>} ) + no_error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A><C/></A>} ) + no_error( validator, %q{<A><D/></A>} ) + end - def test_ref_zero_plus - rng = %q{ + def test_ref_zero_plus + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -531,15 +531,15 @@ class RNGValidation < Test::Unit::TestCase </element> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A/>} ) - no_error( validator, %q{<A><B X=''/></A>} ) - no_error( validator, %q{<A><B X=''/><B X=''/><B X=''/></A>} ) + error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A/>} ) + no_error( validator, %q{<A><B X=''/></A>} ) + no_error( validator, %q{<A><B X=''/><B X=''/><B X=''/></A>} ) - rng = %q{ + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -556,18 +556,18 @@ class RNGValidation < Test::Unit::TestCase </zeroOrMore> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A/>} ) - no_error( validator, %q{<A><B X=''/></A>} ) - no_error( validator, %q{<A><B X=''/><B X=''/><B X=''/></A>} ) - end + error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A/>} ) + no_error( validator, %q{<A><B X=''/></A>} ) + no_error( validator, %q{<A><B X=''/><B X=''/><B X=''/></A>} ) + end - def test_ref_one_plus - rng = %q{ + def test_ref_one_plus + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -584,15 +584,15 @@ class RNGValidation < Test::Unit::TestCase </element> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/></A>} ) - error( validator, %q{<A/>} ) - no_error( validator, %q{<A><B X=''/></A>} ) - no_error( validator, %q{<A><B X=''/><B X=''/><B X=''/></A>} ) + error( validator, %q{<A><B/></A>} ) + error( validator, %q{<A/>} ) + no_error( validator, %q{<A><B X=''/></A>} ) + no_error( validator, %q{<A><B X=''/><B X=''/><B X=''/></A>} ) - rng = %q{ + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -609,17 +609,17 @@ class RNGValidation < Test::Unit::TestCase </oneOrMore> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/></A>} ) - error( validator, %q{<A/>} ) - no_error( validator, %q{<A><B X=''/></A>} ) - no_error( validator, %q{<A><B X=''/><B X=''/><B X=''/></A>} ) - end + error( validator, %q{<A><B/></A>} ) + error( validator, %q{<A/>} ) + no_error( validator, %q{<A><B X=''/></A>} ) + no_error( validator, %q{<A><B X=''/><B X=''/><B X=''/></A>} ) + end - def test_ref_interleave - rng = %q{ + def test_ref_interleave + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -635,16 +635,16 @@ class RNGValidation < Test::Unit::TestCase <element name="C"/> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/></A>} ) - error( validator, %q{<A><C/></A>} ) - error( validator, %q{<A><C/><C/></A>} ) - no_error( validator, %q{<A><B/><C/></A>} ) - no_error( validator, %q{<A><C/><B/></A>} ) + error( validator, %q{<A><B/></A>} ) + error( validator, %q{<A><C/></A>} ) + error( validator, %q{<A><C/><C/></A>} ) + no_error( validator, %q{<A><B/><C/></A>} ) + no_error( validator, %q{<A><C/><B/></A>} ) - rng = %q{ + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -660,16 +660,16 @@ class RNGValidation < Test::Unit::TestCase </interleave> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A><B/></A>} ) - error( validator, %q{<A><C/></A>} ) - error( validator, %q{<A><C/><C/></A>} ) - no_error( validator, %q{<A><B/><C/></A>} ) - no_error( validator, %q{<A><C/><B/></A>} ) + error( validator, %q{<A><B/></A>} ) + error( validator, %q{<A><C/></A>} ) + error( validator, %q{<A><C/><C/></A>} ) + no_error( validator, %q{<A><B/><C/></A>} ) + no_error( validator, %q{<A><C/><B/></A>} ) - rng = %q{ + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -688,18 +688,18 @@ class RNGValidation < Test::Unit::TestCase <element name="C"/> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) - - error( validator, %q{<A><B/></A>} ) - error( validator, %q{<A><C/></A>} ) - error( validator, %q{<A><C/><C/></A>} ) - no_error( validator, %q{<A><B/><C/></A>} ) - no_error( validator, %q{<A><C/><B/></A>} ) - end + } + validator = REXML::Validation::RelaxNG.new( rng ) - def test_ref_recurse - rng = %q{ + error( validator, %q{<A><B/></A>} ) + error( validator, %q{<A><C/></A>} ) + error( validator, %q{<A><C/><C/></A>} ) + no_error( validator, %q{<A><B/><C/></A>} ) + no_error( validator, %q{<A><C/><B/></A>} ) + end + + def test_ref_recurse + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -716,16 +716,16 @@ class RNGValidation < Test::Unit::TestCase </element> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - error( validator, %q{<A></A>} ) - no_error( validator, %q{<A><B/></A>} ) - no_error( validator, %q{<A><B><B/></B></A>} ) - end + error( validator, %q{<A></A>} ) + no_error( validator, %q{<A><B/></A>} ) + no_error( validator, %q{<A><B><B/></B></A>} ) + end - def test_ref_optional - rng = %q{ + def test_ref_optional + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -741,15 +741,15 @@ class RNGValidation < Test::Unit::TestCase </element> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - no_error( validator, %q{<A></A>} ) - no_error( validator, %q{<A><B/></A>} ) - error( validator, %q{<A><B/><B/></A>} ) - error( validator, %q{<A><C/></A>} ) + no_error( validator, %q{<A></A>} ) + no_error( validator, %q{<A><B/></A>} ) + error( validator, %q{<A><B/><B/></A>} ) + error( validator, %q{<A><C/></A>} ) - rng = %q{ + rng = %q{ <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> @@ -765,28 +765,28 @@ class RNGValidation < Test::Unit::TestCase </optional> </define> </grammar> - } - validator = REXML::Validation::RelaxNG.new( rng ) + } + validator = REXML::Validation::RelaxNG.new( rng ) - no_error( validator, %q{<A></A>} ) - no_error( validator, %q{<A><B/></A>} ) - error( validator, %q{<A><B/><B/></A>} ) - error( validator, %q{<A><C/></A>} ) - end + no_error( validator, %q{<A></A>} ) + no_error( validator, %q{<A><B/></A>} ) + error( validator, %q{<A><B/><B/></A>} ) + error( validator, %q{<A><C/></A>} ) + end - def error( validator, source ) - parser = REXML::Parsers::TreeParser.new( source ) - parser.add_listener( validator.reset ) - assert_raise( REXML::Validation::ValidationException, - "Expected a validation error" ) { parser.parse } - end + def error( validator, source ) + parser = REXML::Parsers::TreeParser.new( source ) + parser.add_listener( validator.reset ) + assert_raise( REXML::Validation::ValidationException, + "Expected a validation error" ) { parser.parse } + end - def no_error( validator, source ) - parser = REXML::Parsers::TreeParser.new( source ) - parser.add_listener( validator.reset ) - assert_nothing_raised { parser.parse } + def no_error( validator, source ) + parser = REXML::Parsers::TreeParser.new( source ) + parser.add_listener( validator.reset ) + assert_nothing_raised { parser.parse } + end end end -end |