Skip to content

Commit

Permalink
GH #1: Fix output in system-out/system-err
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksieger committed Mar 26, 2010
1 parent dd6cc9e commit a5d3b65
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions History.txt
@@ -1,3 +1,8 @@
== 1.6.2

- GH #1: Properly escape text in system-out and system-err tags (Matt Kanwisher)
- GH #2: Report rspec before(:all) failures (Edgars Beigarts)

== 1.6.1

- Add 'skipped' flag for pending RSpec examples (Aaron Unger)
Expand Down
1 change: 1 addition & 0 deletions acceptance/test_unit_example_test.rb
Expand Up @@ -3,6 +3,7 @@

class TestUnitExampleTestOne < Test::Unit::TestCase
def test_one
puts "Some <![CDATA[on stdout]]>"
assert(false, "First failure")
end
def teardown
Expand Down
3 changes: 3 additions & 0 deletions acceptance/verification_spec.rb
Expand Up @@ -18,6 +18,9 @@
doc.root.attributes["tests"].should == "1"
doc.root.elements.to_a("/testsuite/testcase").size.should == 1
doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 2
doc.root.elements.to_a("/testsuite/system-out").first.texts.inject("") do |c,e|
c << e.value; c
end.strip.should == "Some <![CDATA[on stdout]]>"
end

it "should have no errors or failures for TestUnitExampleTestTwo" do
Expand Down
4 changes: 2 additions & 2 deletions lib/ci/reporter/test_suite.rb
Expand Up @@ -92,10 +92,10 @@ def builder.trunc!(txt)
tc.to_xml(builder)
end
builder.tag! "system-out" do
builder.cdata! self.stdout
builder.text! self.stdout
end
builder.tag! "system-err" do
builder.cdata! self.stderr
builder.text! self.stderr
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/ci/reporter/output_capture_spec.rb
Expand Up @@ -28,8 +28,8 @@
root = REXML::Document.new(@suite.to_xml).root
root.elements.to_a('//system-out').length.should == 1
root.elements.to_a('//system-err').length.should == 1
root.elements.to_a('//system-out').first.cdatas.first.to_s.should == "Hello\n"
root.elements.to_a('//system-err').first.cdatas.first.to_s.should == "Hi"
root.elements.to_a('//system-out').first.texts.first.to_s.strip.should == "Hello"
root.elements.to_a('//system-err').first.texts.first.to_s.strip.should == "Hi"
end

it "should return $stdout and $stderr to original value after finish" do
Expand Down

0 comments on commit a5d3b65

Please sign in to comment.