testunitxml 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. data/docs/html/classes/REXML.html +111 -0
  2. data/docs/html/classes/REXML/Attributes.html +151 -0
  3. data/docs/html/classes/REXML/Attributes.src/M000001.html +24 -0
  4. data/docs/html/classes/Test.html +131 -0
  5. data/docs/html/classes/Test/Unit.html +124 -0
  6. data/docs/html/classes/Test/Unit/TestCase.html +125 -0
  7. data/docs/html/classes/Test/Unit/XML.html +237 -0
  8. data/docs/html/classes/Test/Unit/XML.src/M000002.html +23 -0
  9. data/docs/html/classes/Test/Unit/XML/NodeIterator.html +195 -0
  10. data/docs/html/classes/Test/Unit/XML/NodeIterator.src/M000003.html +27 -0
  11. data/docs/html/classes/Test/Unit/XML/NodeIterator.src/M000004.html +19 -0
  12. data/docs/html/classes/Test/Unit/XML/NodeIterator.src/M000005.html +18 -0
  13. data/docs/html/classes/Test/Unit/XML/NodeIterator.src/M000006.html +20 -0
  14. data/docs/html/classes/Test/Unit/XML/NodeIterator/NullNodeFilter.html +137 -0
  15. data/docs/html/classes/Test/Unit/XML/NodeIterator/NullNodeFilter.src/M000007.html +18 -0
  16. data/docs/html/classes/Test/Unit/XML/XmlEqualFilter.html +144 -0
  17. data/docs/html/classes/Test/Unit/XML/XmlEqualFilter.src/M000008.html +23 -0
  18. data/docs/html/created.rid +1 -0
  19. data/docs/html/files/MIT-LICENSE.html +130 -0
  20. data/docs/html/files/README.html +226 -0
  21. data/docs/html/files/lib/test/unit/xml/attributes_mixin_rb.html +101 -0
  22. data/docs/html/files/lib/test/unit/xml/nodeiterator_rb.html +101 -0
  23. data/docs/html/files/lib/test/unit/xml/xml_assertions_rb.html +112 -0
  24. data/docs/html/files/lib/test/unit/xml/xmlequalfilter_rb.html +101 -0
  25. data/docs/html/files/lib/test/unit/xml_rb.html +120 -0
  26. data/docs/html/fr_class_index.html +35 -0
  27. data/docs/html/fr_file_index.html +33 -0
  28. data/docs/html/fr_method_index.html +34 -0
  29. data/docs/html/index.html +24 -0
  30. data/lib/test/unit/xml.rb +21 -0
  31. data/lib/test/unit/xml/attributes_mixin.rb +21 -0
  32. data/lib/test/unit/xml/nodeiterator.rb +61 -0
  33. data/lib/test/unit/xml/xml_assertions.rb +187 -0
  34. data/lib/test/unit/xml/xmlequalfilter.rb +27 -0
  35. data/test/data/test1.xml +23 -0
  36. data/test/tc_testunitxml.rb +123 -0
  37. metadata +101 -0
@@ -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: xmlequalfilter.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>xmlequalfilter.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/xmlequalfilter.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Jan 09 22:18:03 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,120 @@
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: xml.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>xml.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.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Jan 09 22:18:03 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
+ <div id="description">
72
+ <p>
73
+ This file mixes in XML assertions in the <a
74
+ href="../../../../classes/Test/Unit/TestCase.html">Test::Unit::TestCase</a>
75
+ class.
76
+ </p>
77
+ <p>
78
+ See xml_assertions.rb for information about the assertions that are mixed
79
+ in.
80
+ </p>
81
+
82
+ </div>
83
+
84
+ <div id="requires-list">
85
+ <h3 class="section-bar">Required files</h3>
86
+
87
+ <div class="name-list">
88
+ test/unit/xml/xml_assertions&nbsp;&nbsp;
89
+ </div>
90
+ </div>
91
+
92
+ </div>
93
+
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <!-- if method_list -->
110
+
111
+
112
+ </div>
113
+
114
+
115
+ <div id="validator-badges">
116
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
117
+ </div>
118
+
119
+ </body>
120
+ </html>
@@ -0,0 +1,35 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Classes
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Classes</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Classes</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/REXML.html">REXML</a><br />
24
+ <a href="classes/REXML/Attributes.html">REXML::Attributes</a><br />
25
+ <a href="classes/Test.html">Test</a><br />
26
+ <a href="classes/Test/Unit.html">Test::Unit</a><br />
27
+ <a href="classes/Test/Unit/TestCase.html">Test::Unit::TestCase</a><br />
28
+ <a href="classes/Test/Unit/XML.html">Test::Unit::XML</a><br />
29
+ <a href="classes/Test/Unit/XML/NodeIterator.html">Test::Unit::XML::NodeIterator</a><br />
30
+ <a href="classes/Test/Unit/XML/NodeIterator/NullNodeFilter.html">Test::Unit::XML::NodeIterator::NullNodeFilter</a><br />
31
+ <a href="classes/Test/Unit/XML/XmlEqualFilter.html">Test::Unit::XML::XmlEqualFilter</a><br />
32
+ </div>
33
+ </div>
34
+ </body>
35
+ </html>
@@ -0,0 +1,33 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Files
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Files</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Files</h1>
22
+ <div id="index-entries">
23
+ <a href="files/MIT-LICENSE.html">MIT-LICENSE</a><br />
24
+ <a href="files/README.html">README</a><br />
25
+ <a href="files/lib/test/unit/xml_rb.html">lib/test/unit/xml.rb</a><br />
26
+ <a href="files/lib/test/unit/xml/attributes_mixin_rb.html">lib/test/unit/xml/attributes_mixin.rb</a><br />
27
+ <a href="files/lib/test/unit/xml/nodeiterator_rb.html">lib/test/unit/xml/nodeiterator.rb</a><br />
28
+ <a href="files/lib/test/unit/xml/xml_assertions_rb.html">lib/test/unit/xml/xml_assertions.rb</a><br />
29
+ <a href="files/lib/test/unit/xml/xmlequalfilter_rb.html">lib/test/unit/xml/xmlequalfilter.rb</a><br />
30
+ </div>
31
+ </div>
32
+ </body>
33
+ </html>
@@ -0,0 +1,34 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Methods
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Methods</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Methods</h1>
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 />
31
+ </div>
32
+ </div>
33
+ </body>
34
+ </html>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
+
6
+ <!--
7
+
8
+ RDoc Documentation
9
+
10
+ -->
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
+ <head>
13
+ <title>RDoc Documentation</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ </head>
16
+ <frameset rows="20%, 80%">
17
+ <frameset cols="25%,35%,45%">
18
+ <frame src="fr_file_index.html" title="Files" name="Files" />
19
+ <frame src="fr_class_index.html" name="Classes" />
20
+ <frame src="fr_method_index.html" name="Methods" />
21
+ </frameset>
22
+ <frame src="files/README.html" name="docwin" />
23
+ </frameset>
24
+ </html>
@@ -0,0 +1,21 @@
1
+ =begin rdoc
2
+ This file mixes in XML assertions in the Test::Unit::TestCase
3
+ class.
4
+
5
+ See #xml_assertions.rb for information about the assertions
6
+ that are mixed in.
7
+ =end
8
+
9
+ require 'test/unit/xml/xml_assertions'
10
+
11
+ module Test
12
+ module Unit
13
+
14
+ # The module Test::Unit::XML is mixed in into the class
15
+ # Test::Unit::TestCase
16
+ class TestCase
17
+ include Test::Unit::XML
18
+ end
19
+ end
20
+ end
21
+
@@ -0,0 +1,21 @@
1
+ module REXML
2
+
3
+ # The REXML::Attributes mix-in adds methods that are useful for
4
+ # attribute collections, but not present in the standard
5
+ # REXML::Attributes class
6
+ class Attributes
7
+
8
+ # The +get_attribute_ns+ method retrieves a method by its namespace
9
+ # and name. Thus it is possible to reliably identify an attribute
10
+ # even if an XML processor has changed the prefix.
11
+ def get_attribute_ns(namespace, name)
12
+ each_attribute() { |attribute|
13
+ if name == attribute.name &&
14
+ namespace == attribute.namespace()
15
+ return attribute
16
+ end
17
+ }
18
+ nil
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,61 @@
1
+ #! /usr/bin/ruby
2
+
3
+ module Test
4
+ module Unit
5
+ module XML
6
+ class NodeIterator
7
+
8
+ class NullNodeFilter
9
+ def accept(node)
10
+ true
11
+ end
12
+ end
13
+
14
+ # This class method takes a node as an argument and locates the
15
+ # next node. The first argument is a node. The second argument
16
+ # is an optional node filter.
17
+ def NodeIterator.find_next_node(node, node_filter = NullNodeFilter.new)
18
+ next_node = nil
19
+ if NodeIterator.has_children?(node) then
20
+ next_node = node[0] # The index should be 1 according to the REXML docs
21
+ elsif node.next_sibling_node
22
+ next_node = node.next_sibling_node
23
+ elsif NodeIterator.has_parent_with_sibling?(node)
24
+ next_node = node.parent.next_sibling_node
25
+ end
26
+ return next_node if node_filter.accept(next_node) || next_node == nil
27
+ find_next_node(next_node, node_filter)
28
+ end
29
+
30
+
31
+ def initialize(node, node_filter = NullNodeFilter.new)
32
+ @node_filter = node_filter
33
+ @next_node = node
34
+ end
35
+
36
+ def has_next()
37
+ @next_node ? true : false
38
+ end
39
+
40
+ def next
41
+ node = @next_node
42
+ @next_node = NodeIterator.find_next_node(node, @node_filter)
43
+ node
44
+ end
45
+
46
+
47
+
48
+
49
+ private
50
+
51
+ def NodeIterator.has_children?(node)
52
+ node.respond_to?(:[]) && node.respond_to?(:size) && node.size > 0
53
+ end
54
+
55
+ def NodeIterator.has_parent_with_sibling?(node)
56
+ node.parent && node.parent.next_sibling_node
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end