diff options
author | murphy <murphy@rubychan.de> | 2006-07-10 00:32:57 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2006-07-10 00:32:57 +0000 |
commit | 9f4c7ab7553f9be7c9d14da0ba7462ad746c2f5d (patch) | |
tree | 686ee95cc9010314278846936476d1cf0bf04353 /demo | |
parent | 42436798565c36a7d9582fcf587946d273083ab1 (diff) | |
download | coderay-9f4c7ab7553f9be7c9d14da0ba7462ad746c2f5d.tar.gz |
Big re-indenting - no more tabs!
Diffstat (limited to 'demo')
-rw-r--r-- | demo/suite.rb | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/demo/suite.rb b/demo/suite.rb index 40c044a..c0be470 100644 --- a/demo/suite.rb +++ b/demo/suite.rb @@ -7,46 +7,46 @@ require 'test/unit' include Test::Unit
class CodeRaySuite < TestCase
-
- def self.dir &block
- @dir ||= File.dirname(__FILE__)
- if block
- Dir.chdir @dir, &block
- end
- @dir
- end
-
- def dir &block
- self.class.dir(&block)
- end
-
- def test_ALL
- dir do
- for input in Dir["demo_*.rb"] - %w(demo_server.rb demo_stream.rb)
- puts "[ testing #{input}... ]"
- name = File.basename(input, ".rb")
- output = name + '.out'
- code = File.open(input, 'rb') { |f| break f.read }
-
- result = `ruby -wI../lib #{input}`
-
- if File.exist? output
- expected = File.read output
- ok = expected == result
- computed = output.sub('.out', '.computed')
- unless ok
- File.open(computed, 'w') { |f| f.write result }
- print `gvimdiff #{output} #{computed}` if $DEBUG
- end
- assert(ok, "Output error: #{computed} != #{output}") unless $DEBUG
- else
- File.open(output, 'w') do |f| f.write result end
- puts "New test: #{output}"
- end
-
- end
- end
- end
+
+ def self.dir &block
+ @dir ||= File.dirname(__FILE__)
+ if block
+ Dir.chdir @dir, &block
+ end
+ @dir
+ end
+
+ def dir &block
+ self.class.dir(&block)
+ end
+
+ def test_ALL
+ dir do
+ for input in Dir["demo_*.rb"] - %w(demo_server.rb demo_stream.rb)
+ puts "[ testing #{input}... ]"
+ name = File.basename(input, ".rb")
+ output = name + '.out'
+ code = File.open(input, 'rb') { |f| break f.read }
+
+ result = `ruby -wI../lib #{input}`
+
+ if File.exist? output
+ expected = File.read output
+ ok = expected == result
+ computed = output.sub('.out', '.computed')
+ unless ok
+ File.open(computed, 'w') { |f| f.write result }
+ print `gvimdiff #{output} #{computed}` if $DEBUG
+ end
+ assert(ok, "Output error: #{computed} != #{output}") unless $DEBUG
+ else
+ File.open(output, 'w') do |f| f.write result end
+ puts "New test: #{output}"
+ end
+
+ end
+ end
+ end
end
@@ -55,28 +55,28 @@ $suite = TestSuite.new 'CodeRay Demos Test' $suite << CodeRaySuite.suite
def load_suite name
- begin
- require name + '/suite.rb'
- rescue LoadError
- $stderr.puts <<-ERR
+ begin
+ require name + '/suite.rb'
+ rescue LoadError
+ $stderr.puts <<-ERR
!! Folder #{File.split(__FILE__).first + '/' + name} not found
-
- ERR
- false
- end
+
+ ERR
+ false
+ end
end
if subsuite = ARGV.find { |a| break $1 if a[/^([^-].*)/] }
- load_suite(subsuite) or exit
+ load_suite(subsuite) or exit
else
- Dir[mydir + '/*/'].each { |suite| load_suite suite }
+ Dir[mydir + '/*/'].each { |suite| load_suite suite }
end
if ARGV.include? '-f'
- require 'test/unit/ui/fox/testrunner'
- UI::Fox::TestRunner.run $suite
+ require 'test/unit/ui/fox/testrunner'
+ UI::Fox::TestRunner.run $suite
else
- require 'test/unit/ui/console/testrunner'
- UI::Console::TestRunner.run $suite
+ require 'test/unit/ui/console/testrunner'
+ UI::Console::TestRunner.run $suite
end
|