aboutsummaryrefslogtreecommitdiffstats
path: root/test/rexml
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-15 11:55:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-15 11:55:52 +0000
commit3a47cf3395dd4c4fe8bdd5df13aab698f2ca314b (patch)
treec4a278220ba8141b829c5c7b0777c1049cfe413c /test/rexml
parent39da1b63699faf30c86e753e193c29b81b16136d (diff)
downloadruby-3a47cf3395dd4c4fe8bdd5df13aab698f2ca314b.tar.gz
* remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml')
-rw-r--r--test/rexml/test_attributes.rb4
-rw-r--r--test/rexml/test_contrib.rb18
-rw-r--r--test/rexml/test_doctype.rb14
-rw-r--r--test/rexml/test_elements.rb12
-rw-r--r--test/rexml/test_encoding_2.rb2
-rw-r--r--test/rexml/test_entity.rb10
-rw-r--r--test/rexml/test_functions.rb2
-rw-r--r--test/rexml/test_jaxen.rb46
-rw-r--r--test/rexml/test_light.rb4
-rw-r--r--test/rexml/test_listener.rb6
-rw-r--r--test/rexml/test_notationdecl_mixin.rb6
-rw-r--r--test/rexml/test_notationdecl_parsetest.rb2
-rw-r--r--test/rexml/test_pullparser.rb10
-rw-r--r--test/rexml/test_sax.rb14
-rw-r--r--test/rexml/test_stream.rb8
-rw-r--r--test/rexml/test_validation_rng.rb6
-rw-r--r--test/rexml/test_xml_declaration_parent_child.rb6
-rw-r--r--test/rexml/test_xpath.rb106
-rw-r--r--test/rexml/test_xpath_attribute_query.rb28
-rw-r--r--test/rexml/test_xpath_pred.rb6
20 files changed, 155 insertions, 155 deletions
diff --git a/test/rexml/test_attributes.rb b/test/rexml/test_attributes.rb
index 51a7774b0f..e46850de3a 100644
--- a/test/rexml/test_attributes.rb
+++ b/test/rexml/test_attributes.rb
@@ -91,10 +91,10 @@ class AttributesTester < Test::Unit::TestCase
# Submitted by Kou
def test_namespace_conflict
- assert_raise( ParseException,
+ assert_raise( ParseException,
"Declaring two attributes with the same namespace should be an error" ) do
REXML::Document.new <<-XML
- <x xmlns:n1="http://www.w3.org"
+ <x xmlns:n1="http://www.w3.org"
xmlns:n2="http://www.w3.org" >
<bad n1:a="1" n2:a="2" />
</x>
diff --git a/test/rexml/test_contrib.rb b/test/rexml/test_contrib.rb
index eb16b8946c..7d00202c95 100644
--- a/test/rexml/test_contrib.rb
+++ b/test/rexml/test_contrib.rb
@@ -92,7 +92,7 @@ DELIMITER
doc = REXML::Document.new source
assert_equal "myprog-config", doc.root.name
count = 0
- REXML::XPath.each(doc, "x:myprog-config/x:main/x:parameter",
+ REXML::XPath.each(doc, "x:myprog-config/x:main/x:parameter",
{"x"=>"http://someurl/program/version"}) { |element|
assert_equal "name", element.attributes["name"]
count += 1;
@@ -183,7 +183,7 @@ DELIMITER
result = XPath.first(doc, xpath)
assert_equal desired_result.to_s, result.to_s
end
-
+
def test_xpath_whitespace_TobiasReif
# same as above, with whitespace in XPath
doc = Document.new(XML_STRING_01.dup)
@@ -193,7 +193,7 @@ DELIMITER
failure_message = "\n[[[TR: AFAIK, whitespace should be allowed]]]\n"
assert_equal(desired_result.to_s, result.to_s, failure_message)
end
-
+
def test_xpath_02_TobiasReif
doc = Document.new XML_STRING_01.dup
desired_result = Document.new '<author>Thomas, David; Hunt, Andrew</author>'
@@ -211,7 +211,7 @@ DELIMITER
failure_message = "\nHow to handle the apos inside the string inside the XPath?\nXPath = #{xpath}\n"
assert_equal desired_result.to_s, result.to_s, failure_message
end
-
+
def test_xpath_03_TobiasReif
doc = Document.new XML_STRING_02.dup
desired_result_string = "<entry type='Book'>
@@ -303,7 +303,7 @@ EOF
assert_nil XPath.first(doc,'//leg')
assert_equal 'http://www.foo.com/human', doc.root.elements[1].namespace
- assert_equal 'human leg',
+ assert_equal 'human leg',
XPath.first(doc, '//x:leg/text()', {'x'=>'http://www.foo.com/human'}).to_s
end
@@ -312,8 +312,8 @@ EOF
source = File.new(fixture_path('ProductionSupport.xml'))
h = Hash.new
doc = REXML::Document.new source
- doc.elements.each("//CommonError") { |el|
- h[el.elements['Key'].text] = 'okay'
+ doc.elements.each("//CommonError") { |el|
+ h[el.elements['Key'].text] = 'okay'
}
assert(h.include?('MotorInsuranceContract(Object)>>#error:'))
end
@@ -426,7 +426,7 @@ EOF
assert text !~ /&rbconfig/, "'#{text}' failed"
end
- #Error occurred in test_package_file_opens(TC_PackageInstall):
+ #Error occurred in test_package_file_opens(TC_PackageInstall):
# ArgumentError:
#illegal access mode &rbconfig.prefix;/lib/rexml
#
@@ -464,7 +464,7 @@ EOL
end
end
- def test_maintain_dtd
+ def test_maintain_dtd
src = %q{<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ivattacks SYSTEM "../../ivacm.dtd" [
<!ENTITY % extern-packages SYSTEM "../../ivpackages.dtd">
diff --git a/test/rexml/test_doctype.rb b/test/rexml/test_doctype.rb
index 20603f5378..0a87c0a304 100644
--- a/test/rexml/test_doctype.rb
+++ b/test/rexml/test_doctype.rb
@@ -18,7 +18,7 @@ class TestDocTypeAccessor < Test::Unit::TestCase
<r/>
XMLEND
@doctype1 = REXML::Document.new(document_string1).doctype
-
+
@pubid = "TEST_ID"
document_string2 = <<-"XMLEND"
<!DOCTYPE r PUBLIC "#{@pubid}">
@@ -31,15 +31,15 @@ class TestDocTypeAccessor < Test::Unit::TestCase
<r/>
XMLEND
@doctype3 = REXML::Document.new(document_string3).doctype
-
+
end
-
+
def test_public
assert_equal(nil, @doctype1.public)
assert_equal(@pubid, @doctype2.public)
assert_equal(@pubid, @doctype3.public)
end
-
+
def test_system
assert_equal(@sysid, @doctype1.system)
assert_equal(nil, @doctype2.system)
@@ -50,20 +50,20 @@ class TestDocTypeAccessor < Test::Unit::TestCase
assert_equal(@notid1, @doctype1.notation("n1").system)
assert_equal(@notid2, @doctype1.notation("n2").system)
end
-
+
def test_notations
notations = @doctype1.notations
assert_equal(2, notations.length)
assert_equal(@notid1, find_notation(notations, "n1").system)
assert_equal(@notid2, find_notation(notations, "n2").system)
end
-
+
def find_notation(notations, name)
notations.find { |notation|
name == notation.name
}
end
-
+
end
class TestNotationDeclPublic < Test::Unit::TestCase
diff --git a/test/rexml/test_elements.rb b/test/rexml/test_elements.rb
index 210004a1c0..424b2a2c9b 100644
--- a/test/rexml/test_elements.rb
+++ b/test/rexml/test_elements.rb
@@ -19,16 +19,16 @@ class ElementsTester < Test::Unit::TestCase
doc.root.elements['c'] = Element.new('d')
assert_equal 'd', doc.root.elements[1].name
end
-
+
def test_elements_delete
doc = Document.new '<a><b/><c/><c id="1"/></a>'
- block = proc { |str|
+ block = proc { |str|
out = ''
doc.write out
- assert_equal str, out
+ assert_equal str, out
}
b = doc.root.elements[1]
- doc.root.elements.delete b
+ doc.root.elements.delete b
block.call( "<a><c/><c id='1'/></a>" )
doc.elements.delete("a/c[@id='1']")
block.call( '<a><c/></a>' )
@@ -90,13 +90,13 @@ class ElementsTester < Test::Unit::TestCase
assert_equal 2, doc.root.elements.to_a("child::node()").size
assert_equal 4, XPath.match(doc.root, "child::node()").size
end
-
+
def test_elements_collect
doc = Document.new( "<a><b id='1'/><b id='2'/></a>" )
r = doc.elements.collect( "/a/b" ) { |e| e.attributes["id"].to_i }
assert_equal( [1,2], r )
end
-
+
def test_elements_inject
doc = Document.new( "<a><b id='1'/><b id='2'/></a>" )
r = doc.elements.inject( "/a/b", 3 ) { |s, e|
diff --git a/test/rexml/test_encoding_2.rb b/test/rexml/test_encoding_2.rb
index 2e845b58a0..6a985f3897 100644
--- a/test/rexml/test_encoding_2.rb
+++ b/test/rexml/test_encoding_2.rb
@@ -44,7 +44,7 @@ END
end
end
- if broken_encodings > 0
+ if broken_encodings > 0
fail "There were #{broken_encodings} encoding failures out of #{UnixCharsets.size} plus some REXML internal encodings"
else
fail "There were no encoding failures"
diff --git a/test/rexml/test_entity.rb b/test/rexml/test_entity.rb
index 5219004a49..e6d6f29007 100644
--- a/test/rexml/test_entity.rb
+++ b/test/rexml/test_entity.rb
@@ -10,23 +10,23 @@ class EntityTester < Test::Unit::TestCase
simple =~ /#{REXML::Entity::GEDECL}/
assert $&
assert_equal simple, $&
-
+
REXML::Entity::ENTITYDECL =~ simple
assert REXML::Entity::matches?(simple)
match = REXML::Entity::ENTITYDECL.match(simple)
assert_equal 'foo', match[1]
assert_equal "'bar'", match[2]
- simple = '<!ENTITY Pub-Status
+ simple = '<!ENTITY Pub-Status
"This is a pre-release of the specification.">'
assert REXML::Entity::matches?(simple)
match = REXML::Entity::ENTITYDECL.match(simple)
assert_equal 'Pub-Status', match[1]
assert_equal '"This is a pre-release of the specification."', match[2]
- txt = '"This is a
+ txt = '"This is a
pre-release of <the> specification."'
- simple = "<!ENTITY Pub-Status
+ simple = "<!ENTITY Pub-Status
#{txt}>"
assert REXML::Entity::matches?(simple)
match = REXML::Entity::ENTITYDECL.match(simple)
@@ -117,7 +117,7 @@ class EntityTester < Test::Unit::TestCase
source = '<!DOCTYPE foo [
<!ENTITY ent "replace">
]><a>replace &ent;</a>'
- doc = REXML::Document.new( source )
+ doc = REXML::Document.new( source )
assert_equal(source, doc.to_s)
assert_equal("replace replace", doc.root.text)
assert_equal(source, doc.to_s)
diff --git a/test/rexml/test_functions.rb b/test/rexml/test_functions.rb
index e0f8a67fc1..082d772e23 100644
--- a/test/rexml/test_functions.rb
+++ b/test/rexml/test_functions.rb
@@ -155,7 +155,7 @@ class FunctionsTester < Test::Unit::TestCase
id_1 = doc.elements["/a/b[@id='1']"]
id_2 = doc.elements["/a/b[@id='2']"]
id_3 = doc.elements["/a/b[@id='3']"]
-
+
good = {
"floor" => [[], [id_1], [id_2], [id_3]],
"ceiling" => [[id_1], [id_2], [id_3], []],
diff --git a/test/rexml/test_jaxen.rb b/test/rexml/test_jaxen.rb
index 1870928438..222cf79c60 100644
--- a/test/rexml/test_jaxen.rb
+++ b/test/rexml/test_jaxen.rb
@@ -41,18 +41,18 @@ class JaxenTester < Test::Unit::TestCase
file = File.new(fixture_path(fname+".xml"))
doc = Document.new( file )
XPath.each( doc, "/tests/document" ) {|e| handleDocument(e)}
-# end
+# end
# }
end
- # processes a tests/document/context node
+ # processes a tests/document/context node
def handleContext( testDoc, ctxElement)
testCtx = XPath.match( testDoc, ctxElement.attributes["select"] )[0]
- namespaces = {}
+ namespaces = {}
if testCtx.class == Element
- testCtx.prefixes.each { |pre| handleNamespace( testCtx, pre, namespaces ) }
+ testCtx.prefixes.each { |pre| handleNamespace( testCtx, pre, namespaces ) }
end
- variables = {}
+ variables = {}
XPath.each( ctxElement, "@*[namespace-uri() = 'http://jaxen.org/test-harness/var']") { |attrib| handleVariable(testCtx, variables, attrib) }
XPath.each( ctxElement, "valueOf") { |e| handleValueOf(testCtx, variables, namespaces, e) }
XPath.each( ctxElement, "test[not(@exception) or (@exception != 'true') ]") { |e| handleNominalTest(testCtx,variables, namespaces, e) }
@@ -61,7 +61,7 @@ class JaxenTester < Test::Unit::TestCase
# processes a tests/document/context/valueOf or tests/document/context/test/valueOf node
def handleValueOf(ctx,variables, namespaces, valueOfElement)
- expected = valueOfElement.text
+ expected = valueOfElement.text
got = XPath.match( ctx, valueOfElement.attributes["select"], namespaces, variables )[0]
assert_true( (got.nil? && expected.nil?) || !got.nil? )
case got.class
@@ -71,10 +71,10 @@ class JaxenTester < Test::Unit::TestCase
assert_equal( expected, got.to_s )
when Instruction
assert_equal( expected, got.content )
- when Fixnum
+ when Fixnum
assert_equal( exected.to_f, got )
when String
- # normalize values for comparison
+ # normalize values for comparison
got = "" if got == nil or got == ""
expected = "" if expected == nil or expected == ""
assert_equal( expected, got )
@@ -82,45 +82,45 @@ class JaxenTester < Test::Unit::TestCase
assert_fail( "Wassup?" )
end
end
-
-
+
+
# processes a tests/document/context/test node ( where @exception is false or doesn't exist )
def handleNominalTest(ctx, variables, namespaces, testElement)
- expected = testElement.attributes["count"]
+ expected = testElement.attributes["count"]
got = XPath.match( ctx, testElement.attributes["select"], namespaces, variables )
# might be a test with no count attribute, but nested valueOf elements
assert( expected == got.size.to_s ) if !expected.nil?
-
- XPath.each( testElement, "valueOf") { |e|
- handleValueOf(got, variables, namespaces, e)
+
+ XPath.each( testElement, "valueOf") { |e|
+ handleValueOf(got, variables, namespaces, e)
}
end
-
- # processes a tests/document/context/test node ( where @exception is true )
+
+ # processes a tests/document/context/test node ( where @exception is true )
def handleExceptionalTest(ctx, variables, namespaces, testElement)
assert_raise( Exception ) {
XPath.match( ctx, testElement.attributes["select"], namespaces, variables )
}
end
- # processes a tests/document node
+ # processes a tests/document node
def handleDocument(docElement)
puts "- Processing document: #{docElement.attributes['url']}"
testFile = File.new( docElement.attributes["url"] )
testDoc = Document.new testFile
XPath.each( docElement, "context") { |e| handleContext(testDoc, e) }
end
-
- # processes a variable definition in a namespace like <test var:foo="bar">
+
+ # processes a variable definition in a namespace like <test var:foo="bar">
def handleVariable( ctx, variables, attrib )
puts "--- Found attribute: #{attrib.name}"
variables[attrib.name] = attrib.value
end
-
- # processes a namespace definition like <test xmlns:foo="fiz:bang:bam">
+
+ # processes a namespace definition like <test xmlns:foo="fiz:bang:bam">
def handleNamespace( ctx, prefix, namespaces )
puts "--- Found namespace: #{prefix}"
- namespaces[prefix] = ctx.namespaces[prefix]
+ namespaces[prefix] = ctx.namespaces[prefix]
end
-
+
end
diff --git a/test/rexml/test_light.rb b/test/rexml/test_light.rb
index 3b9e8adfec..1b56159254 100644
--- a/test/rexml/test_light.rb
+++ b/test/rexml/test_light.rb
@@ -12,7 +12,7 @@ class LightTester < Test::Unit::TestCase
tag, content = parser.parse
assert_equal([:document, :text], [tag, content.first])
end
-
+
# FIXME INCOMPLETE
# This is because the light API is not yet ready to be used to produce
# trees.
@@ -22,7 +22,7 @@ class LightTester < Test::Unit::TestCase
foo = doc.add_element( 'foo' )
assert_equal( "foo", foo.name )
end
-
+
def test_add_attribute
foo = Node.new( "a" )
foo["attr"] = "bar"
diff --git a/test/rexml/test_listener.rb b/test/rexml/test_listener.rb
index f2cc4b7c35..0afbdcd5ff 100644
--- a/test/rexml/test_listener.rb
+++ b/test/rexml/test_listener.rb
@@ -11,7 +11,7 @@ class BaseTester < Test::Unit::TestCase
return unless defined? @listener
# Empty.
t1 = %Q{<string></string>}
- assert_equal( "", @listener.parse( t1 ),
+ assert_equal( "", @listener.parse( t1 ),
"Empty" )
end
@@ -59,11 +59,11 @@ class BaseTester < Test::Unit::TestCase
return unless defined? @listener
# CR.
t7 = %Q{<string> \r\n \r \n </string>}
- assert_equal( " \n \n \n ".unpack("C*").inspect,
+ assert_equal( " \n \n \n ".unpack("C*").inspect,
@listener.parse( t7 ).unpack("C*").inspect, "CR" )
end
- # The accent bug, and the code that exibits the bug, was contributed by
+ # The accent bug, and the code that exibits the bug, was contributed by
# Guilhem Vellut
class AccentListener
def tag_start(name,attributes)
diff --git a/test/rexml/test_notationdecl_mixin.rb b/test/rexml/test_notationdecl_mixin.rb
index d5212534c1..68dcc555ac 100644
--- a/test/rexml/test_notationdecl_mixin.rb
+++ b/test/rexml/test_notationdecl_mixin.rb
@@ -31,11 +31,11 @@ class TestNotationDeclMixin < Test::Unit::TestCase
XMLEND
@doctype = REXML::Document.new(doc_string).doctype
end
-
+
def test_name
assert_equal('n1', @doctype.notation('n1').name)
end
-
+
def test_public_2
assert_equal(@pubid1, @doctype.notation('n1').public)
assert_equal(@pubid2, @doctype.notation('n2').public)
@@ -45,7 +45,7 @@ class TestNotationDeclMixin < Test::Unit::TestCase
assert_equal(@pubid6, @doctype.notation('n6').public)
assert_nil(@doctype.notation('n7').public)
end
-
+
def test_system_2
assert_equal(@sysid2, @doctype.notation('n2').system)
assert_nil(@doctype.notation('n3').system)
diff --git a/test/rexml/test_notationdecl_parsetest.rb b/test/rexml/test_notationdecl_parsetest.rb
index 6a8449e37d..2e86d322e0 100644
--- a/test/rexml/test_notationdecl_parsetest.rb
+++ b/test/rexml/test_notationdecl_parsetest.rb
@@ -14,7 +14,7 @@ class TestNotationDecl < Test::Unit::TestCase
XMLEND
@doctype = REXML::Document.new(doc_string).doctype
end
-
+
def test_notation
assert(@doctype.notation('n1'), "Testing notation n1")
assert(@doctype.notation('n2'), "Testing notation n2")
diff --git a/test/rexml/test_pullparser.rb b/test/rexml/test_pullparser.rb
index 1c9bcc0045..bfce60f268 100644
--- a/test/rexml/test_pullparser.rb
+++ b/test/rexml/test_pullparser.rb
@@ -21,19 +21,19 @@ class PullParserTester < Test::Unit::TestCase
end
res[ :text ] += 1 if results.text?
end
- [ :xmldecl, :doctype, :a, :b ].each { |tag|
+ [ :xmldecl, :doctype, :a, :b ].each { |tag|
assert res[tag] , "#{tag} wasn't processed"
}
- assert_equal 4, res[ :text ]
- rescue ParseException
+ assert_equal 4, res[ :text ]
+ rescue ParseException
puts $!
end
def test_bad_document
source = "<a><b></a>"
parser = REXML::Parsers::PullParser.new(source)
- assert_raise(ParseException, "Parsing should have failed") {
- results = parser.pull while parser.has_next?
+ assert_raise(ParseException, "Parsing should have failed") {
+ results = parser.pull while parser.has_next?
}
end
diff --git a/test/rexml/test_sax.rb b/test/rexml/test_sax.rb
index 569270ceb1..f5d7fb44ce 100644
--- a/test/rexml/test_sax.rb
+++ b/test/rexml/test_sax.rb
@@ -41,7 +41,7 @@ class SAX2Tester < Test::Unit::TestCase
}
start_document = 0
- end_document = 0
+ end_document = 0
parser.listen( :start_document ) { start_document += 1 }
parser.listen( :end_document ) { end_document += 1 }
parser.listen( :start_element, %w{ changelog bugs todo }, &blok )
@@ -69,8 +69,8 @@ class SAX2Tester < Test::Unit::TestCase
assert(text=~/@ANT_VERSION@/, "version was '#{text}'")
tc += 1
}
-
- begin
+
+ begin
parser.parse
rescue => exception
if exception.kind_of? Test::Unit::AssertionFailedError
@@ -255,12 +255,12 @@ class SAX2Tester < Test::Unit::TestCase
assert_equal(252, result[0])
end
- class Ticket68
- include REXML::SAX2Listener
- end
+ class Ticket68
+ include REXML::SAX2Listener
+ end
def test_ticket_68
parser = REXML::Parsers::SAX2Parser.new(File.new(fixture_path('ticket_68.xml')))
- parser.listen( Ticket68.new )
+ parser.listen( Ticket68.new )
begin
parser.parse
rescue
diff --git a/test/rexml/test_stream.rb b/test/rexml/test_stream.rb
index 2d9c177008..3f876aed35 100644
--- a/test/rexml/test_stream.rb
+++ b/test/rexml/test_stream.rb
@@ -12,11 +12,11 @@ class StreamTester < Test::Unit::TestCase
# Submitted by Han Holl
def test_listener
data = %Q{<session1 user="han" password="rootWeiler" />\n<session2 user="han" password="rootWeiler" />}
-
+
b = RequestReader.new( data )
b = RequestReader.new( data )
end
-
+
def test_ticket_49
source = StringIO.new( <<-EOL )
<!DOCTYPE foo [
@@ -26,7 +26,7 @@ class StreamTester < Test::Unit::TestCase
EOL
REXML::Document.parse_stream(source, MyListener.new)
end
-
+
def test_ticket_10
source = StringIO.new( <<-EOL )
<!DOCTYPE foo [
@@ -55,7 +55,7 @@ class StreamTester < Test::Unit::TestCase
end
end
listener.events = {}
-
+
REXML::Document.parse_stream( source, listener )
assert( listener.events[:entitydecl] )
diff --git a/test/rexml/test_validation_rng.rb b/test/rexml/test_validation_rng.rb
index b02363c493..3643f0c32b 100644
--- a/test/rexml/test_validation_rng.rb
+++ b/test/rexml/test_validation_rng.rb
@@ -334,7 +334,7 @@ class RNGValidation < Test::Unit::TestCase
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{
<?xml version="1.0" encoding="UTF-8"?>
@@ -772,13 +772,13 @@ class RNGValidation < Test::Unit::TestCase
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,
+ assert_raise( REXML::Validation::ValidationException,
"Expected a validation error" ) { parser.parse }
end
diff --git a/test/rexml/test_xml_declaration_parent_child.rb b/test/rexml/test_xml_declaration_parent_child.rb
index 6386bed4f1..d883e105c1 100644
--- a/test/rexml/test_xml_declaration_parent_child.rb
+++ b/test/rexml/test_xml_declaration_parent_child.rb
@@ -17,15 +17,15 @@ class TestXmlDeclaration < Test::Unit::TestCase
@root = @doc.root
@xml_declaration = @doc.children[0]
end
-
+
def test_xml_declaration_is_first_child
assert_kind_of(REXML::XMLDecl, @xml_declaration)
end
-
+
def test_xml_declaration_has_document_as_parent
assert_kind_of(REXML::Document, @xml_declaration.parent)
end
-
+
def test_xml_declaration_has_sibling
assert_kind_of(REXML::XMLDecl, @root.previous_sibling.previous_sibling)
assert_kind_of(REXML::Element, @xml_declaration.next_sibling.next_sibling)
diff --git a/test/rexml/test_xpath.rb b/test/rexml/test_xpath.rb
index d7ab9620a8..ad09fcafb2 100644
--- a/test/rexml/test_xpath.rb
+++ b/test/rexml/test_xpath.rb
@@ -163,7 +163,7 @@ class XPathTester < Test::Unit::TestCase
#res = XPath::first(doc, "*")
#assert_equal "a", res.name
- assert_equal( :processing_instruction,
+ assert_equal( :processing_instruction,
XPath::first(doc.root, "processing-instruction()").node_type)
assert_equal( :comment, XPath::first(doc.root, "comment()").node_type)
end
@@ -206,7 +206,7 @@ class XPathTester < Test::Unit::TestCase
# Here are some XPath tests that were originally submitted by ...
# The code has changed some, but the logic and the source documents are the
# same.
- # This method reads a document from a file, and then a series of xpaths,
+ # This method reads a document from a file, and then a series of xpaths,
# also from a file. It then checks each xpath against the source file.
def test_more
xmlsource = fixture_path("testsrc.xml")
@@ -222,7 +222,7 @@ class XPathTester < Test::Unit::TestCase
rt = doc.root
#puts "#"*80
#print "\nDoing #{line} " ; $stdout.flush
- doc.elements.each(line) do |el|
+ doc.elements.each(line) do |el|
#print "." ; $stdout.flush
results.root << el.clone
#results << el.to_s
@@ -255,7 +255,7 @@ class XPathTester < Test::Unit::TestCase
result = XPath::first( @@doc, "descendant::f[@a='c']")
assert_equal "11", result.attributes['id']
-
+
assert_equal "11", XPath::first(@@doc, "a/e/f[@a='c']").attributes["id"]
assert_equal "11", XPath::first(@@doc, "a/e/*[@a='c']").attributes["id"]
end
@@ -282,9 +282,9 @@ class XPathTester < Test::Unit::TestCase
d = XPath.first( doc, "//d" )
assert_equal "d", d.name
b = each_test( d, "ancestor::b" ) { |el|
- assert((1..2) === el.attributes['id'].to_i,
+ assert((1..2) === el.attributes['id'].to_i,
"Expected #{el.attributes['id']} to be either 1 or 2"
- )
+ )
}
assert_equal 2, b
end
@@ -316,7 +316,7 @@ class XPathTester < Test::Unit::TestCase
def test_lang
doc = Document.new(File.new(fixture_path("lang0.xml")))
#puts IO.read( "test/lang.xml" )
-
+
#puts XPath.match( doc, "//language/*" ).size
c = each_test( doc, "//language/*" ) { |element|
#puts "#{element.name}: #{element.text}"
@@ -428,9 +428,9 @@ class XPathTester < Test::Unit::TestCase
assert_equal 2, res.size
end
- # The following three paths were provided by
+ # The following three paths were provided by
# Jeni Tennison <jeni@jenitennison.com>
- # a consultant who is also an XSL and XPath expert
+ # a consultant who is also an XSL and XPath expert
#def test_child_cubed
# els = @@jeni.elements.to_a("*****")
# assert_equal 3, els.size
@@ -445,7 +445,7 @@ class XPathTester < Test::Unit::TestCase
# results = @@jeni.root.elements[1].elements[1].elements.to_a("../following-sibling::*[*[name() = name(current())]]")
# puts results
#end
-
+
# Contributed by Mike Stok
def test_starts_with
source = <<-EOF
@@ -511,7 +511,7 @@ class XPathTester < Test::Unit::TestCase
doc = Document.new source
[
- #['o', 2],
+ #['o', 2],
['foo', 1], ['bar', 0]].each { |search, expected|
set = doc.elements.to_a("//a[contains(@href, '#{search}')]")
assert_equal expected, set.size
@@ -614,7 +614,7 @@ class XPathTester < Test::Unit::TestCase
assert_equal 1, REXML::XPath.match(doc, "//b[number(@id) = (1 mod 2)]").size
assert_equal 1, REXML::XPath.match(doc, "//b[number(@id) = (4 div 2)]").size
end
-
+
# Contributed by Kouhei
def test_substring_before
doc = Document.new("<r><a/><b/><c/></r>")
@@ -629,27 +629,27 @@ class XPathTester < Test::Unit::TestCase
</b>
<c id='b'/>
</a>")
- assert_equal( 1, REXML::XPath.match(doc,
+ assert_equal( 1, REXML::XPath.match(doc,
"//*[local-name()='c' and @id='b']").size )
- assert_equal( 1, REXML::XPath.match(doc,
+ assert_equal( 1, REXML::XPath.match(doc,
"//*[ local-name()='c' and @id='b' ]").size )
- assert_equal( 1, REXML::XPath.match(doc,
+ assert_equal( 1, REXML::XPath.match(doc,
"//*[ local-name() = 'c' and @id = 'b' ]").size )
- assert_equal( 1,
+ assert_equal( 1,
REXML::XPath.match(doc, '/a/c[@id]').size )
assert_equal( 1,
REXML::XPath.match(doc, '/a/c[(@id)]').size )
- assert_equal( 1,
+ assert_equal( 1,
REXML::XPath.match(doc, '/a/c[ @id ]').size )
- assert_equal( 1,
+ assert_equal( 1,
REXML::XPath.match(doc, '/a/c[ (@id) ]').size )
- assert_equal( 1,
+ assert_equal( 1,
REXML::XPath.match(doc, '/a/c[( @id )]').size )
- assert_equal( 1, REXML::XPath.match(doc.root,
+ assert_equal( 1, REXML::XPath.match(doc.root,
'/a/c[ ( @id ) ]').size )
- assert_equal( 1, REXML::XPath.match(doc,
+ assert_equal( 1, REXML::XPath.match(doc,
'/a/c [ ( @id ) ] ').size )
- assert_equal( 1, REXML::XPath.match(doc,
+ assert_equal( 1, REXML::XPath.match(doc,
' / a / c [ ( @id ) ] ').size )
end
@@ -719,8 +719,8 @@ class XPathTester < Test::Unit::TestCase
end
def test_and
- d = Document.new %q{<doc><route run='*' title='HNO'
- destination='debian_production1' date='*' edition='*'
+ d = Document.new %q{<doc><route run='*' title='HNO'
+ destination='debian_production1' date='*' edition='*'
source='debian_satellite1'/></doc>}
assert_equal( nil, d.root.elements["route[@run='0']"] )
assert_equal( nil, d.root.elements["route[@run='0' and @title='HNO']"] )
@@ -803,7 +803,7 @@ class XPathTester < Test::Unit::TestCase
EOL
rd = REXML::Document.new( src )
union = rd.get_elements('//em|//strong')
- assert_equal(2, union.length,
+ assert_equal(2, union.length,
'Both tag types are returned by XPath union operator')
end
@@ -828,7 +828,7 @@ class XPathTester < Test::Unit::TestCase
d = REXML::Document.new( string )
c1 = XPath.match( d, '/a/*/*[1]' )
assert_equal( 1, c1.length )
- assert_equal( 'c1', c1[0].name )
+ assert_equal( 'c1', c1[0].name )
end
def test_sum
@@ -872,25 +872,25 @@ class XPathTester < Test::Unit::TestCase
</channel>
</rss>
EOL
- root_node = XPath.first(doc, "rss")
- assert_not_nil root_node
- channel_node = XPath.first(root_node, "channel")
- assert_not_nil channel_node
- items = XPath.match(channel_node, "*")
- assert_equal 4, items.size
- items = XPath.match(channel_node, "item")
+ root_node = XPath.first(doc, "rss")
+ assert_not_nil root_node
+ channel_node = XPath.first(root_node, "channel")
+ assert_not_nil channel_node
+ items = XPath.match(channel_node, "*")
+ assert_equal 4, items.size
+ items = XPath.match(channel_node, "item")
assert_equal 3, items.size # fails
end
def test_ticket_42
- source = "<a></a>"
- doc = Document.new(source)
- bElem = Element.new('b')
- doc.root.add_element(bElem)
- doc.elements.each('//b[name(..) = "a"]') { |x|
- assert_equal x,bElem
- }
+ source = "<a></a>"
+ doc = Document.new(source)
+ bElem = Element.new('b')
+ doc.root.add_element(bElem)
+ doc.elements.each('//b[name(..) = "a"]') { |x|
+ assert_equal x,bElem
+ }
end
def test_ticket_56
@@ -900,7 +900,7 @@ class XPathTester < Test::Unit::TestCase
column_headers = []
- REXML::XPath.each(finaldoc, '//h:form[@action="ModifyCampaign"]//h:th',
+ REXML::XPath.each(finaldoc, '//h:form[@action="ModifyCampaign"]//h:th',
namespaces) do |el|
node = REXML::XPath.first(el, 'h:a/text()', namespaces)
column_headers << (node ? node.value : nil)
@@ -915,17 +915,17 @@ class XPathTester < Test::Unit::TestCase
def test_ticket_70
string = <<EOF
-
-<mydoc>
- <someelement attribute="1.10">Text1, text,
-text</someelement>
+<mydoc>
- <someelement attribute="1.11">Text2, text,
-text</someelement>
+ <someelement attribute="1.10">Text1, text,
+text</someelement>
-
-</mydoc>
+ <someelement attribute="1.11">Text2, text,
+text</someelement>
+
+
+</mydoc>
EOF
doc = Document.new string
@@ -933,7 +933,7 @@ EOF
end
def test_ticket_43
- #url = http://news.search.yahoo.com/news/rss?p=market&ei=UTF-8&fl=0&x=wrt
+ #url = http://news.search.yahoo.com/news/rss?p=market&ei=UTF-8&fl=0&x=wrt
sum = Document.new(File.new(fixture_path("yahoo.xml"))).elements.to_a("//item").size
assert_equal( 10, sum )
@@ -988,12 +988,12 @@ EOF
def ticket_61_fixture(doc, xpath)
matches = []
doc.elements.each(xpath) do |element|
- matches << element
- assert_equal('Add', element.text)
+ matches << element
+ assert_equal('Add', element.text)
assert_equal('ButtonText', element.attributes['class'])
end
assert_equal(1, matches.length)
- end
+ end
def test_ticket_61_text
file = File.open(fixture_path("ticket_61.xml"))
diff --git a/test/rexml/test_xpath_attribute_query.rb b/test/rexml/test_xpath_attribute_query.rb
index 99439f2286..c0ad2c2e8c 100644
--- a/test/rexml/test_xpath_attribute_query.rb
+++ b/test/rexml/test_xpath_attribute_query.rb
@@ -6,7 +6,7 @@ require 'test/unit'
require 'rexml/document'
class TestRexmlXpathAttributeQuery < Test::Unit::TestCase
-
+
# xmlstr1 and xmlstr2 only differ in the second line - namespaces in the root element
@@xmlstr1 = '<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:gCal="http://schemas.google.com/gCal/2005">
@@ -26,7 +26,7 @@ class TestRexmlXpathAttributeQuery < Test::Unit::TestCase
</entry>
</feed>'
-
+
@@xmlstr2 = '<?xml version="1.0" encoding="UTF-8"?>
<feed>
<id>http://www.google.com/calendar/feeds/me%40gmail.com</id>
@@ -44,22 +44,22 @@ class TestRexmlXpathAttributeQuery < Test::Unit::TestCase
</author>
</entry>
</feed>'
-
+
# Fails
def test_xpath_query
do_test @@xmlstr1
end
-
+
# Passes
def test_xpath_query_no_namespace
do_test @@xmlstr2
end
-
+
def do_test(xmlString)
- hrefs = [
- "http://www.google.com/calendar/feeds/me%40gmail.com/private/full",
- "http://www.google.com/calendar/feeds/me%40gmail.com/acl/full",
- "http://www.google.com/calendar/feeds/me%40gmail.com/me%40gmail.com"
+ hrefs = [
+ "http://www.google.com/calendar/feeds/me%40gmail.com/private/full",
+ "http://www.google.com/calendar/feeds/me%40gmail.com/acl/full",
+ "http://www.google.com/calendar/feeds/me%40gmail.com/me%40gmail.com"
]
ctr=0
REXML::Document.new(xmlString).elements.each("feed/entry") do |element|
@@ -70,13 +70,13 @@ class TestRexmlXpathAttributeQuery < Test::Unit::TestCase
end
end
-
+
def test_another_way
doc = REXML::Document.new(@@xmlstr1)
- hrefs = [
- "http://www.google.com/calendar/feeds/me%40gmail.com/private/full",
- "http://www.google.com/calendar/feeds/me%40gmail.com/acl/full",
- "http://www.google.com/calendar/feeds/me%40gmail.com/me%40gmail.com"
+ hrefs = [
+ "http://www.google.com/calendar/feeds/me%40gmail.com/private/full",
+ "http://www.google.com/calendar/feeds/me%40gmail.com/acl/full",
+ "http://www.google.com/calendar/feeds/me%40gmail.com/me%40gmail.com"
]
ctr=0
REXML::XPath.each(doc, "//link[@rel='alternate']") do |element|
diff --git a/test/rexml/test_xpath_pred.rb b/test/rexml/test_xpath_pred.rb
index 373a7f562b..584358966a 100644
--- a/test/rexml/test_xpath_pred.rb
+++ b/test/rexml/test_xpath_pred.rb
@@ -20,7 +20,7 @@ class XPathPredicateTester < Test::Unit::TestCase
</section>
</article>
EOL
-
+
def setup
@doc = REXML::Document.new( SRC )
@parser = REXML::Parsers::XPathParser.new
@@ -48,8 +48,8 @@ class XPathPredicateTester < Test::Unit::TestCase
assert_equal( 1, m.size )
assert_equal( "1", m[0].attributes["id"] )
end
-
- def do_path( path )
+
+ def do_path( path )
m = REXML::XPath.match( @doc, path )
#puts path, @parser.parse( path ).inspect
return m