diff --git a/test/rexml/data/euc.xml b/test/rexml/data/euc.xml
index 685f84b8b4..a3c3419498 100644
--- a/test/rexml/data/euc.xml
+++ b/test/rexml/data/euc.xml
@@ -1,296 +1,296 @@
-
-
-
-
-
-
-
-
-
-Ruby-mswin32
-
-
-
-
-あるいは、Windowsとの終わりなき戦い ;-(
-[日本語 / English]
-
-
-
-
-
-
-
-
-
-このページでは、mswin32版rubyの配布と変更状況のお知らせを行っています。
-ここは別に公式ページでもなんでもなくて、私が勝手に書いてるページです。ここで入手できるプログラム・情報(無いに等しいけど)については、各自の判断でご利用ください。
-問い合わせは私へ。間違っても他の人に迷惑をかけるようなことはしないでね。
-
-
-
-
-Rubyのサイトをご覧下さい。
-
-
-
-
-mswin32版rubyとは、32bit版Windows(Windows95・Windows98・WindowsMe・Windows NT・Windows 2000・WindowsXP・Windows 2003 Server、以下Windowsと表記)上で動作するRubyのバイナリの一つです。
-Windows上で動作するRubyとしては、現在、5種類のバイナリが存在します。これらはそれぞれmswin32版・cygwin版・mingw32版・bccwin32版・djgpp版と呼ばれています。
-それぞれの違いをまとめると以下のようになります(事実誤認があればお知らせください)。
-
-- mswin32版
-
-
VC++でコンパイルされる。Windowsから見ればもっとも「普通」のバイナリと言えるが、反面、Rubyが持つUNIXで特徴的な機能の一部が使用できない。1.7.3以降はmingw32版と拡張ライブラリについてはバイナリ互換性がある。
-RUBY_PLATFORMは*-mswin32。
-
-- cygwin版
-
-
gccでコンパイルされ、cygwin環境で動作する。cygwin環境がUNIXライクな環境をWindows上で構築するものであるので、当然、cygwin版rubyは一般のUNIX用のものとだいたい同じように動作する(ことが期待できる)。
-RUBY_PLATFORMは*-cygwin。
-
-- mingw32版
-
-
gccでコンパイルされる。ソースはほとんどmswin32版と共通であり、ランタイムライブラリも共通(MSVCRT.dll)なので、動作も(おそらく)mswin32版とほぼ同じ。1.7.3以降はmswin32版と拡張ライブラリについてはバイナリ互換性がある。
-RUBY_PLATFORMは*-mingw32。
-
-- bccwin32版
-
-
BC++でコンパイルされる。ソースはかなりの部分がmswin32版と共通ではあるが、ランタイムライブラリが異なるので、細かいところで挙動がmswin32版とは異なる(はず)。1.7以降でサポートされる。
-RUBY_PLATFORMは*-bccwin32。
-
-- djgpp版
-
-
DJGPPでコンパイルされる。DOS用のバイナリなので、もちろんDOSでも動作する。反面、WindowsにあってDOSにない機能の多くが使えない(ネットワーク関連など)。
-RUBY_PLATFORMは*-msdosdjgpp。
-
-
-このページでは、上記のうちmswin32版のみを扱っています。
-なお、cygwin版・mingw32版・djgpp版についてはわたなべさんのRuby binariesから入手可能です。また、bccwin32版については小西さんのRubyから入手可能です。
-
-
-
-
-現在配布中の全てのバイナリはVC++ 5.0(Version 11.00.7022 for 80x86)でmakeしたものです。ruby自体に関しては、標準配布のソース(またはCVSのソース)からそのまま作成しています。拡張ライブラリについては各々のリンク先を参照してください。
-いずれのバイナリもzip形式でアーカイブされています。
-md5sumのチェック方法ですが、例えばrubyがインストールされているなら下記のような方法があります。
-ruby -r md5 -e "puts MD5.new(File.open('filename', 'rb').read).hexdigest"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-上記のバイナリをインストールする場合は、お好みのディレクトリ(以下$TOPDIR
と記述)に展開してください。ディレクトリ付きで圧縮されてますので、展開時にはディレクトリ付きで展開するのを忘れずに(意味がわからない人は気にしなくていいです)。
-展開後は、$TOPDIR\bin
にPATH
を通しておいてください。
-なお、以下の拡張ライブラリは、この配布物に含まれない外部のライブラリに依存しています。
-
-- curses.so : PDCursesに依存しています。
-- dbm.so : GDBMに依存しています。
-- gdbm.so : GDBMに依存しています。
-- iconv.so : Iconvに依存しています。
-- openssl.so : OpenSSLに依存しています。
-- readline.so : readlineに依存しています。
-- tcltklib.so : Tcl/Tkに依存しています。
-- zlib.so : Zlibに依存しています。
-
-上記のうち、PDCurses・GDBM・OpenSSL・readline・Zlibについては、Porting Libraries to Win32にバイナリが存在します。
-Iconvについては、Meadowy.orgで配布されているiconv-1.8.win32.zipを利用しています。
-Tcl/Tkについては、ActiveStateで配布されているActiveTclを利用しています。
-
-
-
-
-
-
-
-
-あけましておめでとうございます。って遅いよ!
-ruby-1.8.1-20040127とruby-1.9.0-20040126を置きました。
-前者は主に1.8.1リリース版で発見された不具合の修正です。後者は開発版。
-
-
-メリークリスマス! ruby-1.8.1がリリースされました!
-(previewを一つ飛ばしちゃいました、ごめんなさい...)
-
-
-ruby-1.8.1-preview3を置きました。思いのほか間が空いちゃいましたね。
-
-
-ruby-1.8.1-preview2を置きました。
-
-
-ruby-1.8.1-20031027を置きました。
-racc-1.4.4-allを置きました。
-
-
-eruby-1.0.4・vrswin-030906・vruby-030906を置きました。
-
-
-ruby-1.8.0-20030812を置きました。
-vrswin-030811・vruby-030811を置きました。今回から置く拡張ライブラリは全て1.8用になります。
-
-
-ruby-1.8.0を置きました。Ruby 1.8系最初のリリースとなります。
-1.6系からの変更点については、changes.1.8.0などをご覧ください。
-
-
-ruby-1.8.0-preview6を置きました。えーと、これを含めてあと2回previewが出る模様です :)
-
-
-ruby-1.8.0-preview5を置きました。おそらくこれが1.8.0の最後のpreviewになるでしょう。
-ruby-1.6.8-20030727を置きました。
-
-
-
-
-こちらをどうぞ。
-
-
-
-
-mswin32版に関する(と思われる)リンクです。勝手に張ってますので、不都合があれば私までご連絡ください。
-
-
-
-
-
-written by U.Nakamura
-
-ruby 1.9.0 (2004-01-13)
-ERb 2.0.4
-RDtool 0.6.11
-rublog 0.0.2
-
-
-
-
+
+
+
+
+
+
+
+
+
+Ruby-mswin32
+
+
+
+
+あるいは、Windowsとの終わりなき戦い ;-(
+[日本語 / English]
+
+
+
+
+
+
+
+
+
+このページでは、mswin32版rubyの配布と変更状況のお知らせを行っています。
+ここは別に公式ページでもなんでもなくて、私が勝手に書いてるページです。ここで入手できるプログラム・情報(無いに等しいけど)については、各自の判断でご利用ください。
+問い合わせは私へ。間違っても他の人に迷惑をかけるようなことはしないでね。
+
+
+
+
+Rubyのサイトをご覧下さい。
+
+
+
+
+mswin32版rubyとは、32bit版Windows(Windows95・Windows98・WindowsMe・Windows NT・Windows 2000・WindowsXP・Windows 2003 Server、以下Windowsと表記)上で動作するRubyのバイナリの一つです。
+Windows上で動作するRubyとしては、現在、5種類のバイナリが存在します。これらはそれぞれmswin32版・cygwin版・mingw32版・bccwin32版・djgpp版と呼ばれています。
+それぞれの違いをまとめると以下のようになります(事実誤認があればお知らせください)。
+
+- mswin32版
-
+
VC++でコンパイルされる。Windowsから見ればもっとも「普通」のバイナリと言えるが、反面、Rubyが持つUNIXで特徴的な機能の一部が使用できない。1.7.3以降はmingw32版と拡張ライブラリについてはバイナリ互換性がある。
+RUBY_PLATFORMは*-mswin32。
+
+- cygwin版
-
+
gccでコンパイルされ、cygwin環境で動作する。cygwin環境がUNIXライクな環境をWindows上で構築するものであるので、当然、cygwin版rubyは一般のUNIX用のものとだいたい同じように動作する(ことが期待できる)。
+RUBY_PLATFORMは*-cygwin。
+
+- mingw32版
-
+
gccでコンパイルされる。ソースはほとんどmswin32版と共通であり、ランタイムライブラリも共通(MSVCRT.dll)なので、動作も(おそらく)mswin32版とほぼ同じ。1.7.3以降はmswin32版と拡張ライブラリについてはバイナリ互換性がある。
+RUBY_PLATFORMは*-mingw32。
+
+- bccwin32版
-
+
BC++でコンパイルされる。ソースはかなりの部分がmswin32版と共通ではあるが、ランタイムライブラリが異なるので、細かいところで挙動がmswin32版とは異なる(はず)。1.7以降でサポートされる。
+RUBY_PLATFORMは*-bccwin32。
+
+- djgpp版
-
+
DJGPPでコンパイルされる。DOS用のバイナリなので、もちろんDOSでも動作する。反面、WindowsにあってDOSにない機能の多くが使えない(ネットワーク関連など)。
+RUBY_PLATFORMは*-msdosdjgpp。
+
+
+このページでは、上記のうちmswin32版のみを扱っています。
+なお、cygwin版・mingw32版・djgpp版についてはわたなべさんのRuby binariesから入手可能です。また、bccwin32版については小西さんのRubyから入手可能です。
+
+
+
+
+現在配布中の全てのバイナリはVC++ 5.0(Version 11.00.7022 for 80x86)でmakeしたものです。ruby自体に関しては、標準配布のソース(またはCVSのソース)からそのまま作成しています。拡張ライブラリについては各々のリンク先を参照してください。
+いずれのバイナリもzip形式でアーカイブされています。
+md5sumのチェック方法ですが、例えばrubyがインストールされているなら下記のような方法があります。
+ruby -r md5 -e "puts MD5.new(File.open('filename', 'rb').read).hexdigest"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+上記のバイナリをインストールする場合は、お好みのディレクトリ(以下$TOPDIR
と記述)に展開してください。ディレクトリ付きで圧縮されてますので、展開時にはディレクトリ付きで展開するのを忘れずに(意味がわからない人は気にしなくていいです)。
+展開後は、$TOPDIR\bin
にPATH
を通しておいてください。
+なお、以下の拡張ライブラリは、この配布物に含まれない外部のライブラリに依存しています。
+
+- curses.so : PDCursesに依存しています。
+- dbm.so : GDBMに依存しています。
+- gdbm.so : GDBMに依存しています。
+- iconv.so : Iconvに依存しています。
+- openssl.so : OpenSSLに依存しています。
+- readline.so : readlineに依存しています。
+- tcltklib.so : Tcl/Tkに依存しています。
+- zlib.so : Zlibに依存しています。
+
+上記のうち、PDCurses・GDBM・OpenSSL・readline・Zlibについては、Porting Libraries to Win32にバイナリが存在します。
+Iconvについては、Meadowy.orgで配布されているiconv-1.8.win32.zipを利用しています。
+Tcl/Tkについては、ActiveStateで配布されているActiveTclを利用しています。
+
+
+
+
+
+
+
+
+あけましておめでとうございます。って遅いよ!
+ruby-1.8.1-20040127とruby-1.9.0-20040126を置きました。
+前者は主に1.8.1リリース版で発見された不具合の修正です。後者は開発版。
+
+
+メリークリスマス! ruby-1.8.1がリリースされました!
+(previewを一つ飛ばしちゃいました、ごめんなさい...)
+
+
+ruby-1.8.1-preview3を置きました。思いのほか間が空いちゃいましたね。
+
+
+ruby-1.8.1-preview2を置きました。
+
+
+ruby-1.8.1-20031027を置きました。
+racc-1.4.4-allを置きました。
+
+
+eruby-1.0.4・vrswin-030906・vruby-030906を置きました。
+
+
+ruby-1.8.0-20030812を置きました。
+vrswin-030811・vruby-030811を置きました。今回から置く拡張ライブラリは全て1.8用になります。
+
+
+ruby-1.8.0を置きました。Ruby 1.8系最初のリリースとなります。
+1.6系からの変更点については、changes.1.8.0などをご覧ください。
+
+
+ruby-1.8.0-preview6を置きました。えーと、これを含めてあと2回previewが出る模様です :)
+
+
+ruby-1.8.0-preview5を置きました。おそらくこれが1.8.0の最後のpreviewになるでしょう。
+ruby-1.6.8-20030727を置きました。
+
+
+
+
+こちらをどうぞ。
+
+
+
+
+mswin32版に関する(と思われる)リンクです。勝手に張ってますので、不都合があれば私までご連絡ください。
+
+
+
+
+
+written by U.Nakamura
+
+ruby 1.9.0 (2004-01-13)
+ERb 2.0.4
+RDtool 0.6.11
+rublog 0.0.2
+
+
+
+
diff --git a/test/rexml/data/xp.tst b/test/rexml/data/xp.tst
index fb670010b2..6551372575 100644
--- a/test/rexml/data/xp.tst
+++ b/test/rexml/data/xp.tst
@@ -1,27 +1,27 @@
-/
-/rss
-//rss
-/rss/channel
-//link
-//image/*
-//link[2]
-//link[last()]
-rss/channel/link[last()]
-rss/channel/item/link[last()]
-rss/channel/item/link[1]
-rss/channel/item[@x='1']
-rss/channel/item[@x]
-//item[@x]
-//item[normalize-space(@name)='x']
-//*[count(title)=1]
-//*[name()='link']
-//*[starts-with(name(),'li')]
-//*[contains(name(),'y')]
-//*[string-length(name()) = 4]
-//copyright | //title
-/child::rss
-/descendant::*
-//language/parent::*
-/rss/channel/ancestor::*
-//item[position() mod 2 = 0 ]
+/
+/rss
+//rss
+/rss/channel
+//link
+//image/*
+//link[2]
+//link[last()]
+rss/channel/link[last()]
+rss/channel/item/link[last()]
+rss/channel/item/link[1]
+rss/channel/item[@x='1']
+rss/channel/item[@x]
+//item[@x]
+//item[normalize-space(@name)='x']
+//*[count(title)=1]
+//*[name()='link']
+//*[starts-with(name(),'li')]
+//*[contains(name(),'y')]
+//*[string-length(name()) = 4]
+//copyright | //title
+/child::rss
+/descendant::*
+//language/parent::*
+/rss/channel/ancestor::*
+//item[position() mod 2 = 0 ]
//item/ancestor::*
\ No newline at end of file
diff --git a/test/rexml/test_functions_number.rb b/test/rexml/test_functions_number.rb
index 849b60edb8..3048c8dd00 100644
--- a/test/rexml/test_functions_number.rb
+++ b/test/rexml/test_functions_number.rb
@@ -1,32 +1,32 @@
-require 'rexml/document'
-require 'test/unit'
-require 'rexml/functions'
-
-class TC_Rexml_Functions_Number < Test::Unit::TestCase
-
- def test_functions_number_int
- telem = REXML::Element.new("elem")
- telem.text="9"
- assert_equal(9, REXML::Functions::number(telem))
- end
- def test_functions_number_float
- telem = REXML::Element.new("elem")
- telem.text="10.4"
- assert_equal(10.4, REXML::Functions::number(telem))
- end
- def test_functions_number_negative_int
- telem = REXML::Element.new("elem")
- telem.text="-9"
- assert_equal(-9, REXML::Functions::number(telem))
- end
- def test_functions_number_negative_float
- telem = REXML::Element.new("elem")
- telem.text="-9.13"
- assert_equal(-9.13, REXML::Functions::number(telem))
- end
- #def test_functions_number_scientific_notation
- # telem = REXML::Element.new("elem")
- # telem.text="9.13E12"
- # assert_equal(9.13E12, REXML::Functions::number(telem))
- #end
-end
+require 'rexml/document'
+require 'test/unit'
+require 'rexml/functions'
+
+class TC_Rexml_Functions_Number < Test::Unit::TestCase
+
+ def test_functions_number_int
+ telem = REXML::Element.new("elem")
+ telem.text="9"
+ assert_equal(9, REXML::Functions::number(telem))
+ end
+ def test_functions_number_float
+ telem = REXML::Element.new("elem")
+ telem.text="10.4"
+ assert_equal(10.4, REXML::Functions::number(telem))
+ end
+ def test_functions_number_negative_int
+ telem = REXML::Element.new("elem")
+ telem.text="-9"
+ assert_equal(-9, REXML::Functions::number(telem))
+ end
+ def test_functions_number_negative_float
+ telem = REXML::Element.new("elem")
+ telem.text="-9.13"
+ assert_equal(-9.13, REXML::Functions::number(telem))
+ end
+ #def test_functions_number_scientific_notation
+ # telem = REXML::Element.new("elem")
+ # telem.text="9.13E12"
+ # assert_equal(9.13E12, REXML::Functions::number(telem))
+ #end
+end
diff --git a/test/rexml/test_jaxen.rb b/test/rexml/test_jaxen.rb
index 96c0c7bf48..1870928438 100644
--- a/test/rexml/test_jaxen.rb
+++ b/test/rexml/test_jaxen.rb
@@ -1,126 +1,126 @@
-require 'rexml_test_utils'
-
-require "rexml/document"
-require "rexml/xpath"
-
-# Harness to test REXML's capabilities against the test suite from Jaxen
-# ryan.a.cox@gmail.com
-
-class JaxenTester < Test::Unit::TestCase
- include REXMLTestUtils
- include REXML
-
- def test_axis ; test("axis") ; end
- def test_basic ; test("basic") ; end
- def test_basicupdate ; test("basicupdate") ; end
- def test_contents ; test("contents") ; end
- def test_defaultNamespace ; test("defaultNamespace") ; end
- def test_fibo ; test("fibo") ; end
- def test_id ; test("id") ; end
- def test_jaxen24 ; test("jaxen24") ; end
- def test_lang ; test("lang") ; end
- def test_message ; test("message") ; end
- def test_moreover ; test("moreover") ; end
- def test_much_ado ; test("much_ado") ; end
- def test_namespaces ; test("namespaces") ; end
- def test_nitf ; test("nitf") ; end
- def test_numbers ; test("numbers") ; end
- def test_pi ; test("pi") ; end
- def test_pi2 ; test("pi2") ; end
- def test_simple ; test("simple") ; end
- def test_testNamespaces ; test("testNamespaces") ; end
- def test_text ; test("text") ; end
- def test_underscore ; test("underscore") ; end
- def test_web ; test("web") ; end
- def test_web2 ; test("web2") ; end
-
- private
- def test( fname )
-# Dir.entries( xml_dir ).each { |fname|
-# if fname =~ /\.xml$/
- file = File.new(fixture_path(fname+".xml"))
- doc = Document.new( file )
- XPath.each( doc, "/tests/document" ) {|e| handleDocument(e)}
-# end
-# }
- end
-
- # processes a tests/document/context node
- def handleContext( testDoc, ctxElement)
- testCtx = XPath.match( testDoc, ctxElement.attributes["select"] )[0]
- namespaces = {}
- if testCtx.class == Element
- testCtx.prefixes.each { |pre| handleNamespace( testCtx, pre, namespaces ) }
- end
- 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) }
- XPath.each( ctxElement, "test[@exception = 'true']") { |e| handleExceptionalTest(testCtx,variables, namespaces, e) }
- end
-
- # processes a tests/document/context/valueOf or tests/document/context/test/valueOf node
- def handleValueOf(ctx,variables, namespaces, valueOfElement)
- expected = valueOfElement.text
- got = XPath.match( ctx, valueOfElement.attributes["select"], namespaces, variables )[0]
- assert_true( (got.nil? && expected.nil?) || !got.nil? )
- case got.class
- when Element
- assert_equal( got.class, Element )
- when Attribute, Text, Comment, TrueClass, FalseClass
- assert_equal( expected, got.to_s )
- when Instruction
- assert_equal( expected, got.content )
- when Fixnum
- assert_equal( exected.to_f, got )
- when String
- # normalize values for comparison
- got = "" if got == nil or got == ""
- expected = "" if expected == nil or expected == ""
- assert_equal( expected, got )
- else
- 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"]
- 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)
- }
- end
-
- # 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
- 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
- def handleVariable( ctx, variables, attrib )
- puts "--- Found attribute: #{attrib.name}"
- variables[attrib.name] = attrib.value
- end
-
- # processes a namespace definition like
- def handleNamespace( ctx, prefix, namespaces )
- puts "--- Found namespace: #{prefix}"
- namespaces[prefix] = ctx.namespaces[prefix]
- end
-
-end
+require 'rexml_test_utils'
+
+require "rexml/document"
+require "rexml/xpath"
+
+# Harness to test REXML's capabilities against the test suite from Jaxen
+# ryan.a.cox@gmail.com
+
+class JaxenTester < Test::Unit::TestCase
+ include REXMLTestUtils
+ include REXML
+
+ def test_axis ; test("axis") ; end
+ def test_basic ; test("basic") ; end
+ def test_basicupdate ; test("basicupdate") ; end
+ def test_contents ; test("contents") ; end
+ def test_defaultNamespace ; test("defaultNamespace") ; end
+ def test_fibo ; test("fibo") ; end
+ def test_id ; test("id") ; end
+ def test_jaxen24 ; test("jaxen24") ; end
+ def test_lang ; test("lang") ; end
+ def test_message ; test("message") ; end
+ def test_moreover ; test("moreover") ; end
+ def test_much_ado ; test("much_ado") ; end
+ def test_namespaces ; test("namespaces") ; end
+ def test_nitf ; test("nitf") ; end
+ def test_numbers ; test("numbers") ; end
+ def test_pi ; test("pi") ; end
+ def test_pi2 ; test("pi2") ; end
+ def test_simple ; test("simple") ; end
+ def test_testNamespaces ; test("testNamespaces") ; end
+ def test_text ; test("text") ; end
+ def test_underscore ; test("underscore") ; end
+ def test_web ; test("web") ; end
+ def test_web2 ; test("web2") ; end
+
+ private
+ def test( fname )
+# Dir.entries( xml_dir ).each { |fname|
+# if fname =~ /\.xml$/
+ file = File.new(fixture_path(fname+".xml"))
+ doc = Document.new( file )
+ XPath.each( doc, "/tests/document" ) {|e| handleDocument(e)}
+# end
+# }
+ end
+
+ # processes a tests/document/context node
+ def handleContext( testDoc, ctxElement)
+ testCtx = XPath.match( testDoc, ctxElement.attributes["select"] )[0]
+ namespaces = {}
+ if testCtx.class == Element
+ testCtx.prefixes.each { |pre| handleNamespace( testCtx, pre, namespaces ) }
+ end
+ 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) }
+ XPath.each( ctxElement, "test[@exception = 'true']") { |e| handleExceptionalTest(testCtx,variables, namespaces, e) }
+ end
+
+ # processes a tests/document/context/valueOf or tests/document/context/test/valueOf node
+ def handleValueOf(ctx,variables, namespaces, valueOfElement)
+ expected = valueOfElement.text
+ got = XPath.match( ctx, valueOfElement.attributes["select"], namespaces, variables )[0]
+ assert_true( (got.nil? && expected.nil?) || !got.nil? )
+ case got.class
+ when Element
+ assert_equal( got.class, Element )
+ when Attribute, Text, Comment, TrueClass, FalseClass
+ assert_equal( expected, got.to_s )
+ when Instruction
+ assert_equal( expected, got.content )
+ when Fixnum
+ assert_equal( exected.to_f, got )
+ when String
+ # normalize values for comparison
+ got = "" if got == nil or got == ""
+ expected = "" if expected == nil or expected == ""
+ assert_equal( expected, got )
+ else
+ 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"]
+ 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)
+ }
+ end
+
+ # 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
+ 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
+ def handleVariable( ctx, variables, attrib )
+ puts "--- Found attribute: #{attrib.name}"
+ variables[attrib.name] = attrib.value
+ end
+
+ # processes a namespace definition like
+ def handleNamespace( ctx, prefix, namespaces )
+ puts "--- Found namespace: #{prefix}"
+ namespaces[prefix] = ctx.namespaces[prefix]
+ end
+
+end
diff --git a/test/rexml/test_xpath_msw.rb b/test/rexml/test_xpath_msw.rb
index c03835e2f3..d0b474faf5 100644
--- a/test/rexml/test_xpath_msw.rb
+++ b/test/rexml/test_xpath_msw.rb
@@ -1,38 +1,38 @@
-require "test/unit/testcase"
-require "rexml/document"
-
-class XPathAxesTester < Test::Unit::TestCase
- include REXML
- SOURCE = <<-EOF
-
-
-
-
-
-
-
-
- EOF
-
- def setup
- @@doc = Document.new(SOURCE) unless defined? @@doc
- end
-
- def test_preceding_sibling_axis
- context = XPath.first(@@doc,"/a/e/f[last()]")
- assert_equal "6", context.attributes["id"]
-
- prev = XPath.first(context, "preceding-sibling::f")
- assert_equal "5", prev.attributes["id"]
-
- prev = XPath.first(context, "preceding-sibling::f[1]")
- assert_equal "5", prev.attributes["id"]
-
- prev = XPath.first(context, "preceding-sibling::f[2]")
- assert_equal "4", prev.attributes["id"]
-
- prev = XPath.first(context, "preceding-sibling::f[3]")
- assert_equal "3", prev.attributes["id"]
- end
-end
-
+require "test/unit/testcase"
+require "rexml/document"
+
+class XPathAxesTester < Test::Unit::TestCase
+ include REXML
+ SOURCE = <<-EOF
+
+
+
+
+
+
+
+
+ EOF
+
+ def setup
+ @@doc = Document.new(SOURCE) unless defined? @@doc
+ end
+
+ def test_preceding_sibling_axis
+ context = XPath.first(@@doc,"/a/e/f[last()]")
+ assert_equal "6", context.attributes["id"]
+
+ prev = XPath.first(context, "preceding-sibling::f")
+ assert_equal "5", prev.attributes["id"]
+
+ prev = XPath.first(context, "preceding-sibling::f[1]")
+ assert_equal "5", prev.attributes["id"]
+
+ prev = XPath.first(context, "preceding-sibling::f[2]")
+ assert_equal "4", prev.attributes["id"]
+
+ prev = XPath.first(context, "preceding-sibling::f[3]")
+ assert_equal "3", prev.attributes["id"]
+ end
+end
+