diff options
author | murphy <murphy@rubychan.de> | 2009-12-31 02:56:55 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2009-12-31 02:56:55 +0000 |
commit | 46b83c9c5384a299cdc8d8c5381259b1f6d0e4aa (patch) | |
tree | e2930e60c4324f7a17f923ba68c15a6bab5d5576 /sample/suite.rb | |
parent | 77fc494cbdbde2719875fb0d7caf2454ef298fca (diff) | |
download | coderay-46b83c9c5384a299cdc8d8c5381259b1f6d0e4aa.tar.gz |
Fixed example tests.
* test:clean task also deletes .expected.html files
* LinesOfCode encoder can deal with tokens that have no scanner.
Tests were added for this.
* JSON encoder load rubygems if necessary.
* NEW :loc as an alias for :lines_of_code
* NEW Scanner methods marshal_dump, marshal_load
FIXED Tokens dumping (failed while trying to dump @scanner)
Diffstat (limited to 'sample/suite.rb')
-rw-r--r-- | sample/suite.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sample/suite.rb b/sample/suite.rb index c586697..fa24114 100644 --- a/sample/suite.rb +++ b/sample/suite.rb @@ -28,16 +28,19 @@ class CodeRaySuite < TestCase name = File.basename(input, ".rb") output = name + '.expected' code = File.open(input, 'rb') { |f| break f.read } - + result = `ruby -wI../lib #{input}` - + + diff = output.sub '.expected', '.diff' + File.delete diff if File.exist? diff + computed = output.sub '.expected', '.actual' if File.exist? output expected = File.read output ok = expected == result - computed = output.sub('.expected', '.actual') unless ok File.open(computed, 'w') { |f| f.write result } - print `diff #{output} #{computed}` if $DEBUG + `diff #{output} #{computed} > #{diff}` if $DEBUG + puts "Test failed; output written to #{diff}." end assert(ok, "Output error: #{computed} != #{output}") unless $DEBUG else |