summaryrefslogtreecommitdiff
path: root/test/scanners/ruby/class.in.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-04-14 23:59:03 +0000
committermurphy <murphy@rubychan.de>2010-04-14 23:59:03 +0000
commit200144dd009d33ff8334be24d0fb2cc91b3a87ab (patch)
treef46c939cd01b8d4165b5d9f3444c20e072b51408 /test/scanners/ruby/class.in.rb
parent612a14e17bdae5dbb5b13cdceec797523725cbbe (diff)
downloadcoderay-200144dd009d33ff8334be24d0fb2cc91b3a87ab.tar.gz
Moving scanner tests into separate repository. The repository can be reached at http://svn.rubychan.de/coderay-scanner-tests/trunk.
Diffstat (limited to 'test/scanners/ruby/class.in.rb')
-rw-r--r--test/scanners/ruby/class.in.rb83
1 files changed, 0 insertions, 83 deletions
diff --git a/test/scanners/ruby/class.in.rb b/test/scanners/ruby/class.in.rb
deleted file mode 100644
index b8d0bca..0000000
--- a/test/scanners/ruby/class.in.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-$: << File.dirname(__FILE__) + '/..'
-require 'coderay'
-CodeRay::Encoders[:tokens]
-CodeRay::Encoders[:html]
-
-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 extension
- 'in.' + self.class::EXTENSION
- end
-
- def lang
- self.class::LANG
- end
-
- def test_ALL
- CodeRay::Scanners.load lang
- tokenizer = CodeRay.tokens
- highlighter = CodeRay.html
-
- dir do
- for input in Dir["*.#{extension}"]
- name = File.basename(input, ".#{extension}")
- output = name + '.out.tok'
- code = File.read(input)
-
- computed = tokenizer.encode code, lang
-
- if File.exist? output
- expected = File.read output
- assert_equal(expected, computed)
- else
- File.open(output, 'w') do |f| f.write computed end
- puts "New test: #{output}"
- end
-
- highlighted = highlighter.highlight_page code, lang
- File.open(name + '.html', 'w') do |f| f.write highlighted end
- end
- end
- end
-
-end
-
-require 'test/unit/testsuite'
-$suite = TestSuite.new
-
-def load_suite name
- begin
- require name + '/suite.rb'
- rescue LoadError
- $stderr.puts <<-ERR
-
-!! Folder #{File.split(__FILE__).first + '/' + name} not found
-
- ERR
- false
- end
-end
-
-if subsuite = ARGV.first
- load_suite(subsuite) or exit
-else
- Dir['*/'].each { |suite| load_suite suite }
-end
-
-require 'test/unit/ui/console/testrunner'
-UI::Console::TestRunner.run $suite