testunitxml 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/CHANGES +15 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +119 -0
  4. data/docs/html/classes/REXML/Attributes.html +6 -6
  5. data/docs/html/classes/REXML/Attributes.src/{M000001.html → M000004.html} +0 -0
  6. data/docs/html/classes/REXML/DocType.html +207 -0
  7. data/docs/html/classes/REXML/DocType.src/M000005.html +18 -0
  8. data/docs/html/classes/REXML/DocType.src/M000006.html +18 -0
  9. data/docs/html/classes/REXML/DocType.src/M000007.html +18 -0
  10. data/docs/html/classes/REXML/DocType.src/M000008.html +20 -0
  11. data/docs/html/classes/REXML/NotationDecl.html +188 -0
  12. data/docs/html/classes/REXML/NotationDecl.src/M000001.html +18 -0
  13. data/docs/html/classes/REXML/NotationDecl.src/M000002.html +18 -0
  14. data/docs/html/classes/REXML/NotationDecl.src/M000003.html +19 -0
  15. data/docs/html/classes/REXML.html +10 -0
  16. data/docs/html/classes/Test/Unit/XML/NodeIterator/NullNodeFilter.html +5 -5
  17. data/docs/html/classes/Test/Unit/XML/NodeIterator/NullNodeFilter.src/{M000007.html → M000014.html} +0 -0
  18. data/docs/html/classes/Test/Unit/XML/NodeIterator.html +20 -20
  19. data/docs/html/classes/Test/Unit/XML/NodeIterator.src/{M000003.html → M000010.html} +0 -0
  20. data/docs/html/classes/Test/Unit/XML/NodeIterator.src/{M000004.html → M000011.html} +0 -0
  21. data/docs/html/classes/Test/Unit/XML/NodeIterator.src/{M000005.html → M000012.html} +0 -0
  22. data/docs/html/classes/Test/Unit/XML/NodeIterator.src/{M000006.html → M000013.html} +0 -0
  23. data/docs/html/classes/Test/Unit/XML/XmlEqualFilter.html +5 -5
  24. data/docs/html/classes/Test/Unit/XML/XmlEqualFilter.src/{M000008.html → M000015.html} +4 -0
  25. data/docs/html/classes/Test/Unit/XML.html +49 -11
  26. data/docs/html/classes/Test/Unit/XML.src/{M000002.html → M000009.html} +1 -1
  27. data/docs/html/created.rid +1 -1
  28. data/docs/html/files/CHANGES.html +127 -0
  29. data/docs/html/files/README.html +64 -25
  30. data/docs/html/files/lib/test/unit/xml/doctype_mixin_rb.html +101 -0
  31. data/docs/html/files/lib/test/unit/xml/notationdecl_mixin_rb.html +101 -0
  32. data/docs/html/files/lib/test/unit/xml/xml_assertions_rb.html +3 -1
  33. data/docs/html/files/lib/test/unit/xml/xmlequalfilter_rb.html +1 -1
  34. data/docs/html/fr_class_index.html +2 -0
  35. data/docs/html/fr_file_index.html +3 -0
  36. data/docs/html/fr_method_index.html +15 -8
  37. data/lib/test/unit/xml/doctype_mixin.rb +32 -0
  38. data/lib/test/unit/xml/notationdecl_mixin.rb +54 -0
  39. data/lib/test/unit/xml/xml_assertions.rb +75 -7
  40. data/lib/test/unit/xml/xmlequalfilter.rb +10 -6
  41. data/setup.rb +1585 -0
  42. data/test/tc_notationdecl_mixin.rb +50 -0
  43. data/test/tc_testunitxml.rb +172 -1
  44. data/test/ts_testunitxml.rb +12 -0
  45. metadata +33 -11
@@ -0,0 +1,101 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: doctype_mixin.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>doctype_mixin.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/test/unit/xml/doctype_mixin.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Jan 23 14:15:13 CET 2006</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+
73
+ </div>
74
+
75
+
76
+ </div>
77
+
78
+
79
+ <!-- if includes -->
80
+
81
+ <div id="section">
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <!-- if method_list -->
91
+
92
+
93
+ </div>
94
+
95
+
96
+ <div id="validator-badges">
97
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
98
+ </div>
99
+
100
+ </body>
101
+ </html>
@@ -0,0 +1,101 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: notationdecl_mixin.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>notationdecl_mixin.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/test/unit/xml/notationdecl_mixin.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Jan 23 14:20:13 CET 2006</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+
73
+ </div>
74
+
75
+
76
+ </div>
77
+
78
+
79
+ <!-- if includes -->
80
+
81
+ <div id="section">
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <!-- if method_list -->
91
+
92
+
93
+ </div>
94
+
95
+
96
+ <div id="validator-badges">
97
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
98
+ </div>
99
+
100
+ </body>
101
+ </html>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Jan 09 22:18:03 CET 2006</td>
59
+ <td>Mon Jan 23 14:28:19 CET 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -75,6 +75,8 @@
75
75
  <div class="name-list">
76
76
  rexml/document&nbsp;&nbsp;
77
77
  test/unit/xml/attributes_mixin&nbsp;&nbsp;
78
+ test/unit/xml/doctype_mixin&nbsp;&nbsp;
79
+ test/unit/xml/notationdecl_mixin&nbsp;&nbsp;
78
80
  test/unit&nbsp;&nbsp;
79
81
  test/unit/xml/xmlequalfilter&nbsp;&nbsp;
80
82
  test/unit/xml/nodeiterator&nbsp;&nbsp;
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Jan 09 22:18:03 CET 2006</td>
59
+ <td>Fri Jan 20 10:23:24 CET 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -22,6 +22,8 @@
22
22
  <div id="index-entries">
23
23
  <a href="classes/REXML.html">REXML</a><br />
24
24
  <a href="classes/REXML/Attributes.html">REXML::Attributes</a><br />
25
+ <a href="classes/REXML/DocType.html">REXML::DocType</a><br />
26
+ <a href="classes/REXML/NotationDecl.html">REXML::NotationDecl</a><br />
25
27
  <a href="classes/Test.html">Test</a><br />
26
28
  <a href="classes/Test/Unit.html">Test::Unit</a><br />
27
29
  <a href="classes/Test/Unit/TestCase.html">Test::Unit::TestCase</a><br />
@@ -20,11 +20,14 @@
20
20
  <div id="index">
21
21
  <h1 class="section-bar">Files</h1>
22
22
  <div id="index-entries">
23
+ <a href="files/CHANGES.html">CHANGES</a><br />
23
24
  <a href="files/MIT-LICENSE.html">MIT-LICENSE</a><br />
24
25
  <a href="files/README.html">README</a><br />
25
26
  <a href="files/lib/test/unit/xml_rb.html">lib/test/unit/xml.rb</a><br />
26
27
  <a href="files/lib/test/unit/xml/attributes_mixin_rb.html">lib/test/unit/xml/attributes_mixin.rb</a><br />
28
+ <a href="files/lib/test/unit/xml/doctype_mixin_rb.html">lib/test/unit/xml/doctype_mixin.rb</a><br />
27
29
  <a href="files/lib/test/unit/xml/nodeiterator_rb.html">lib/test/unit/xml/nodeiterator.rb</a><br />
30
+ <a href="files/lib/test/unit/xml/notationdecl_mixin_rb.html">lib/test/unit/xml/notationdecl_mixin.rb</a><br />
28
31
  <a href="files/lib/test/unit/xml/xml_assertions_rb.html">lib/test/unit/xml/xml_assertions.rb</a><br />
29
32
  <a href="files/lib/test/unit/xml/xmlequalfilter_rb.html">lib/test/unit/xml/xmlequalfilter.rb</a><br />
30
33
  </div>
@@ -20,14 +20,21 @@
20
20
  <div id="index">
21
21
  <h1 class="section-bar">Methods</h1>
22
22
  <div id="index-entries">
23
- <a href="classes/Test/Unit/XML/XmlEqualFilter.html#M000008">accept (Test::Unit::XML::XmlEqualFilter)</a><br />
24
- <a href="classes/Test/Unit/XML/NodeIterator/NullNodeFilter.html#M000007">accept (Test::Unit::XML::NodeIterator::NullNodeFilter)</a><br />
25
- <a href="classes/Test/Unit/XML.html#M000002">assert_xml_equal (Test::Unit::XML)</a><br />
26
- <a href="classes/Test/Unit/XML/NodeIterator.html#M000003">find_next_node (Test::Unit::XML::NodeIterator)</a><br />
27
- <a href="classes/REXML/Attributes.html#M000001">get_attribute_ns (REXML::Attributes)</a><br />
28
- <a href="classes/Test/Unit/XML/NodeIterator.html#M000005">has_next (Test::Unit::XML::NodeIterator)</a><br />
29
- <a href="classes/Test/Unit/XML/NodeIterator.html#M000004">new (Test::Unit::XML::NodeIterator)</a><br />
30
- <a href="classes/Test/Unit/XML/NodeIterator.html#M000006">next (Test::Unit::XML::NodeIterator)</a><br />
23
+ <a href="classes/Test/Unit/XML/XmlEqualFilter.html#M000015">accept (Test::Unit::XML::XmlEqualFilter)</a><br />
24
+ <a href="classes/Test/Unit/XML/NodeIterator/NullNodeFilter.html#M000014">accept (Test::Unit::XML::NodeIterator::NullNodeFilter)</a><br />
25
+ <a href="classes/Test/Unit/XML.html#M000009">assert_xml_equal (Test::Unit::XML)</a><br />
26
+ <a href="classes/Test/Unit/XML/NodeIterator.html#M000010">find_next_node (Test::Unit::XML::NodeIterator)</a><br />
27
+ <a href="classes/REXML/Attributes.html#M000004">get_attribute_ns (REXML::Attributes)</a><br />
28
+ <a href="classes/Test/Unit/XML/NodeIterator.html#M000012">has_next (Test::Unit::XML::NodeIterator)</a><br />
29
+ <a href="classes/REXML/NotationDecl.html#M000001">name (REXML::NotationDecl)</a><br />
30
+ <a href="classes/Test/Unit/XML/NodeIterator.html#M000011">new (Test::Unit::XML::NodeIterator)</a><br />
31
+ <a href="classes/Test/Unit/XML/NodeIterator.html#M000013">next (Test::Unit::XML::NodeIterator)</a><br />
32
+ <a href="classes/REXML/DocType.html#M000008">notation (REXML::DocType)</a><br />
33
+ <a href="classes/REXML/DocType.html#M000007">notations (REXML::DocType)</a><br />
34
+ <a href="classes/REXML/DocType.html#M000005">public (REXML::DocType)</a><br />
35
+ <a href="classes/REXML/NotationDecl.html#M000003">public (REXML::NotationDecl)</a><br />
36
+ <a href="classes/REXML/DocType.html#M000006">system (REXML::DocType)</a><br />
37
+ <a href="classes/REXML/NotationDecl.html#M000002">system (REXML::NotationDecl)</a><br />
31
38
  </div>
32
39
  </div>
33
40
  </body>
@@ -0,0 +1,32 @@
1
+ module REXML
2
+
3
+ # The REXML::DocType mix-in adds methods that are useful for
4
+ # Doctype declarations, but not present in the standard
5
+ # REXML::DocType class
6
+ class DocType
7
+
8
+ # This method retrieves the public identifier identifying the document's DTD.
9
+ def public
10
+ @long_name
11
+ end
12
+
13
+ # This method retrieves the system identifier identifying the document's DTD
14
+ def system
15
+ @uri
16
+ end
17
+
18
+ # This method returns a list of notations that have been declared in the
19
+ # _internal_ DTD subset. Notations in the external DTD subset are not listed.
20
+ def notations
21
+ children().select {|node| node.kind_of?(REXML::NotationDecl)}
22
+ end
23
+
24
+ # Retrieves a named notation. Only notations declared in the internal
25
+ # DTD subset can be retrieved.
26
+ def notation(name)
27
+ notations.find { |notation_decl|
28
+ notation_decl.name == name
29
+ }
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,54 @@
1
+ module REXML
2
+
3
+ # The REXML::NotationDecl mix-in adds methods that are useful for
4
+ # notation declarations, but not present in the standard
5
+ # REXML::NotationDecl class
6
+ class NotationDecl
7
+
8
+ # This method retrieves the name of the notation.
9
+ def name
10
+ @name
11
+ end
12
+
13
+ # This method retrieves the system identifier specified in the notation
14
+ # declaration. If there is no system identifier defined, the method returns
15
+ # +nil+
16
+ def system
17
+ parse_rest(@rest)[1]
18
+ end
19
+
20
+ # This method retrieves the public identifier specified in the notation
21
+ # declaration. If there is no public identifier defined, the method returns
22
+ # +nil+
23
+ def public
24
+ return nil unless @middle == "PUBLIC"
25
+ parse_rest(@rest)[0]
26
+ end
27
+
28
+ private
29
+
30
+ def parse_rest(rest)
31
+ case rest
32
+ when /^"([^"]+)"\s+"([^"]+)"$/
33
+ return [$1,$2]
34
+ when /^'([^']+)'\s+'([^']+)'$/
35
+ return [$1,$2]
36
+ when /^"([^"]+)"\s+'([^']+)'$/
37
+ return [$1,$2]
38
+ when /^'([^']+)'\s+"([^"]+)"$/
39
+ return [$1,$2]
40
+ when /^"([^"]+)"$/
41
+ return [nil, $1] if @middle == 'SYSTEM'
42
+ return [$1, nil] if @middle == 'PUBLIC'
43
+ raise "Unknown notation keyword: #{@middle}"
44
+ when /^'([^']+)'$/
45
+ return [nil, $1] if @middle == 'SYSTEM'
46
+ return [$1, nil] if @middle == 'PUBLIC'
47
+ raise "Unknown notation keyword: #{@middle}"
48
+ else
49
+ raise "Could not parse \@rest variable in REXML::NotationDecl: |#{@rest}|"
50
+ end
51
+ end
52
+ end
53
+
54
+ end
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'rexml/document'
4
4
  require 'test/unit/xml/attributes_mixin' # Must be required after rexml/document
5
+ require 'test/unit/xml/doctype_mixin' # Must be required after rexml/document
6
+ require 'test/unit/xml/notationdecl_mixin' # Must be required after rexml/document
5
7
  require 'test/unit'
6
8
  require 'test/unit/xml/xmlequalfilter'
7
9
  require 'test/unit/xml/nodeiterator'
@@ -15,7 +17,6 @@ module Test
15
17
  module XML
16
18
 
17
19
  # This method checks whether two well-formed XML documents are equal.
18
- # Doctype declarations are ignored for the purposes of comparison.
19
20
  # Two XML documents are considered equal if:
20
21
  # * They contain the same type of nodes, in the same order,
21
22
  # except for text nodes that are empty, or contain only
@@ -27,11 +28,37 @@ module Test
27
28
  # XML declarations are equal if they have the same version,
28
29
  # encoding, and stand-alone pseudo-attributes.
29
30
  # Doctype::
30
- # Doctype declarations are ignored.
31
+ # Doctypes are equal if they fulfill all of the following conditions:
32
+ # * They have the same public identifier, or neither has a public identifier
33
+ # * If one of the doctypes has a system identifier that is a URN,
34
+ # the other doctype must have a system identifier that is the same URN.
35
+ # System identifiers that are URLs are ignored for comparison purposes.
36
+ # The reason is that the same DTD is very often stored in many different
37
+ # locations (for example different directories on different computers).
38
+ # Therefore the physical location of the DTD does not say anything useful
39
+ # about whether two documents are equal.
40
+ # * An entity declaration present in one of the doctype declarations
41
+ # must also be present in the other.
42
+ # * A notation declaration present in one of the doctype declarations
43
+ # must also be present in the other.
44
+ # Internal General Entity Declaration::
45
+ # Internal General entity declarations are equal if they have the same name,
46
+ # and the same value.
47
+ # External General Entity Declaration::
48
+ # External general entity declarations are equal if they have the same name,
49
+ # and if the identifiers are of the same type (PUBLIC or SYSTEM) and have
50
+ # the same value. Note that if the identifiers are URLs, a comparison may
51
+ # fail even though both URLS point to the same resource, for example if one
52
+ # URL is relative and the other is absolute.
53
+ # Notation Declaration::
54
+ # Notation declarations are equal if they have the same name,
55
+ # and if the identifiers are of the same type (PUBLIC or SYSTEM) and have
56
+ # the same value.
31
57
  # Elements::
32
58
  # Elements are considered equal if they have the same generic
33
- # identifier (tag name) and belong to the same namespace. The
34
- # namespace _prefixes_ may be different.
59
+ # identifier (tag name), belong to the same namespace, and have the same
60
+ # attributes. Note that the namespace _prefixes_ of two elements may be different
61
+ # as long as they belong to the same namespace.
35
62
  # Attributes::
36
63
  # Attributes are equal if they belong to the same namespace,
37
64
  # have the same name, and the same value.
@@ -118,8 +145,7 @@ EOT
118
145
  # TODO: Implement Document comparison
119
146
  true
120
147
  when REXML::DocType
121
- # TODO: Implement DOCTYPE comparison
122
- true
148
+ compare_doctypes(expected_node, actual_node)
123
149
  when REXML::Element :
124
150
  compare_elements(expected_node, actual_node)
125
151
  when REXML::CData
@@ -132,12 +158,30 @@ EOT
132
158
  compare_pi(expected_node, actual_node)
133
159
  when REXML::XMLDecl
134
160
  compare_xml_declaration(expected_node, actual_node)
161
+ #when REXML::Entity
162
+ # compare_xml_entities(expected_node, actual_node)
135
163
  else
136
164
  puts "Unknown node type #{actual_node.class}"
137
165
  false
138
166
  end
139
167
  end
140
168
 
169
+ def compare_doctypes(expected_node, actual_node)
170
+ return compare_system_id(expected_node.system, actual_node.system) &&
171
+ expected_node.public == actual_node.public &&
172
+ compare_xml_internal_dtd_subset(expected_node, actual_node)
173
+ end
174
+
175
+ def compare_system_id(expected_id, actual_id)
176
+ is_expected_urn = expected_id =~ /^urn:/i
177
+ is_actual_urn = actual_id =~ /^urn:/i
178
+ if is_expected_urn || is_actual_urn
179
+ expected_id == actual_id
180
+ else
181
+ true
182
+ end
183
+ end
184
+
141
185
  def compare_elements(expected_node, actual_node)
142
186
  return expected_node.name == actual_node.name &&
143
187
  expected_node.namespace() == actual_node.namespace() &&
@@ -181,7 +225,31 @@ EOT
181
225
  return expected_decl == actual_decl
182
226
  end
183
227
 
184
- end
228
+ def compare_xml_internal_dtd_subset(expected_node, actual_node)
229
+ expected_subset = expected_node.children()
230
+ actual_subset = actual_node.children()
231
+ return false unless expected_subset.length == actual_subset.length
232
+ expected_subset.inject(true) { |memo, expected_decl|
233
+ case expected_decl
234
+ when REXML::Entity
235
+ memo &&
236
+ expected_decl.value == actual_node.entities[expected_decl.name].value &&
237
+ expected_decl.ndata == actual_node.entities[expected_decl.name].ndata
238
+ when REXML::NotationDecl
239
+ actual_notation_decl = actual_node.notation(expected_decl.name)
240
+ memo &&
241
+ actual_notation_decl != nil &&
242
+ expected_decl.name == actual_notation_decl.name &&
243
+ expected_decl.public == actual_notation_decl.public &&
244
+ expected_decl.system == actual_notation_decl.system
245
+ when REXML::Comment
246
+ true
247
+ else
248
+ raise "Unexpected node type in internal DTD subset of expected document: " + expected_decl.inspect
249
+ end
250
+ }
251
+ end
252
+ end
185
253
  end
186
254
  end
187
255
 
@@ -1,16 +1,20 @@
1
1
  #! /usr/bin/ruby
2
2
 
3
- module Test
4
- module Unit
3
+ module Test
4
+ module Unit
5
5
  module XML
6
6
 
7
7
  # This filter class accepts any node except text nodes
8
- # that contain non-significant whitespace
8
+ # that contain non-significant whitespace
9
9
  class XmlEqualFilter
10
10
  def accept(node)
11
11
  case
12
12
  when node.kind_of?(REXML::Text)
13
13
  is_significant?(node.value)
14
+ when node.kind_of?(REXML::Entity)
15
+ false
16
+ when node.kind_of?(REXML::NotationDecl)
17
+ false
14
18
  else
15
19
  true
16
20
  end
@@ -21,7 +25,7 @@ module Test
21
25
  def is_significant?(string)
22
26
  string =~ /^\s*$/ ? false : true
23
27
  end
24
- end
25
- end
26
- end
28
+ end
29
+ end
30
+ end
27
31
  end