|
Revision 549:e07d72733cae, 0.8 kB
(checked in by Sean Russell <ser@…>, 5 months ago)
|
|
Moved and renamed files to conform to Ruby's test suite.
|
| Line | |
|---|
| 1 | require 'test/unit' |
|---|
| 2 | require 'rexml/document' |
|---|
| 3 | |
|---|
| 4 | class OrderTester < Test::Unit::TestCase |
|---|
| 5 | def initialize n |
|---|
| 6 | @doc = REXML::Document.new(DOC) |
|---|
| 7 | @figs = REXML::XPath.match(@doc,'//figure') |
|---|
| 8 | @names = @figs.collect {|f| f.attributes['src']} |
|---|
| 9 | super |
|---|
| 10 | end |
|---|
| 11 | def test_fig1 |
|---|
| 12 | assert_equal 'fig1', @figs[0].attributes['src'] |
|---|
| 13 | end |
|---|
| 14 | def test_fig2 |
|---|
| 15 | assert_equal 'fig2', @figs[1].attributes['src'] |
|---|
| 16 | end |
|---|
| 17 | def test_fig3 |
|---|
| 18 | assert_equal 'fig3', @figs[2].attributes['src'] |
|---|
| 19 | end |
|---|
| 20 | def test_fig4 |
|---|
| 21 | assert_equal 'fig4', @figs[3].attributes['src'] |
|---|
| 22 | end |
|---|
| 23 | end |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | DOC = <<END |
|---|
| 27 | <paper> |
|---|
| 28 | <title>Remove this element and figs order differently</title> |
|---|
| 29 | <figure src="fig1"/> |
|---|
| 30 | <figure src="fig2"/> |
|---|
| 31 | <p>Para of text</p> |
|---|
| 32 | <p>Remove this and figs order differently</p> |
|---|
| 33 | <section> |
|---|
| 34 | <figure src="fig3"/> |
|---|
| 35 | </section> |
|---|
| 36 | <figure src="fig4"/> |
|---|
| 37 | </paper> |
|---|
| 38 | END |
|---|