From 862bc9aa6b002f6b29cf74f93ca66e63cf370819 Mon Sep 17 00:00:00 2001 From: murphy Date: Wed, 31 Mar 2010 22:17:06 +0000 Subject: Upporting changes from 0.9.2 (vs. 0.9.1). --- test/functional/basic.rb | 6 +++--- test/functional/for_redcloth.rb | 20 +++++--------------- test/functional/load_plugin_scanner.rb | 4 ++-- test/functional/suite.rb | 14 ++++++++------ test/functional/word_list.rb | 4 ++-- test/lib/README | 3 ++- test/scanners/coderay_suite.rb | 9 +++++++++ test/scanners/debug/class.expected.raydebug | 1 + test/scanners/php/namespaces.expected.raydebug | 9 +++++++++ test/scanners/php/namespaces.in.php | 9 +++++++++ 10 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 test/scanners/php/namespaces.expected.raydebug create mode 100644 test/scanners/php/namespaces.in.php (limited to 'test') diff --git a/test/functional/basic.rb b/test/functional/basic.rb index 9f68763..150089e 100755 --- a/test/functional/basic.rb +++ b/test/functional/basic.rb @@ -1,5 +1,5 @@ -require "test/unit" -require "coderay" +require 'test/unit' +require 'coderay' class BasicTest < Test::Unit::TestCase @@ -103,7 +103,7 @@ more code # and another comment, in-line. def test_rubygems_not_loaded assert_equal nil, defined? Gem - end unless RUBY_VERSION >= '1.9' + end if ENV['check_rubygems'] && RUBY_VERSION < '1.9' def test_list_of_encoders assert_kind_of(Array, CodeRay::Encoders.list) diff --git a/test/functional/for_redcloth.rb b/test/functional/for_redcloth.rb index e955e30..a1c3100 100644 --- a/test/functional/for_redcloth.rb +++ b/test/functional/for_redcloth.rb @@ -1,23 +1,18 @@ -require "test/unit" - -require 'pathname' -MYDIR = File.dirname(__FILE__) -LIBDIR = Pathname.new(MYDIR).join('..', '..', 'lib').cleanpath.to_s -$LOAD_PATH.unshift LIBDIR -require "coderay" +require 'test/unit' +$: << 'lib' +require 'coderay' begin - require 'rubygems' + require 'rubygems' unless defined? Gem gem 'RedCloth', '>= 4.0.3' rescue nil require 'redcloth' rescue LoadError - $stderr.puts 'RedCloth not found - skipping for_redcloth tests.' + warn 'RedCloth not found - skipping for_redcloth tests.' end class BasicTest < Test::Unit::TestCase def test_for_redcloth - require 'rubygems' require 'coderay/for_redcloth' assert_equal "

puts "Hello, World!"

", RedCloth.new('@[ruby]puts "Hello, World!"@').to_html @@ -30,7 +25,6 @@ class BasicTest < Test::Unit::TestCase end def test_for_redcloth_no_lang - require 'rubygems' require 'coderay/for_redcloth' assert_equal "

puts \"Hello, World!\"

", RedCloth.new('@puts "Hello, World!"@').to_html @@ -41,7 +35,6 @@ class BasicTest < Test::Unit::TestCase end def test_for_redcloth_style - require 'rubygems' require 'coderay/for_redcloth' assert_equal <<-BLOCKCODE.chomp,
puts \"Hello, World!\"
@@ -50,7 +43,6 @@ class BasicTest < Test::Unit::TestCase end def test_for_redcloth_escapes - require 'rubygems' require 'coderay/for_redcloth' assert_equal '

>

', RedCloth.new('@[ruby]>@').to_html @@ -63,7 +55,6 @@ class BasicTest < Test::Unit::TestCase end def test_for_redcloth_escapes2 - require 'rubygems' require 'coderay/for_redcloth' assert_equal "

#include <test.h>

", RedCloth.new('@[c]#include @').to_html @@ -71,7 +62,6 @@ class BasicTest < Test::Unit::TestCase # See http://jgarber.lighthouseapp.com/projects/13054/tickets/124-code-markup-does-not-allow-brackets. def test_for_redcloth_false_positive - require 'rubygems' require 'coderay/for_redcloth' assert_equal '

[project]_dff.skjd

', RedCloth.new('@[project]_dff.skjd@').to_html diff --git a/test/functional/load_plugin_scanner.rb b/test/functional/load_plugin_scanner.rb index d778e08..25bbc93 100755 --- a/test/functional/load_plugin_scanner.rb +++ b/test/functional/load_plugin_scanner.rb @@ -1,5 +1,5 @@ -require "test/unit" -require "coderay" +require 'test/unit' +require 'coderay' class PluginScannerTest < Test::Unit::TestCase diff --git a/test/functional/suite.rb b/test/functional/suite.rb index ae9c7f0..039ab47 100755 --- a/test/functional/suite.rb +++ b/test/functional/suite.rb @@ -1,10 +1,12 @@ require 'test/unit' -require 'pathname' MYDIR = File.dirname(__FILE__) -LIBDIR = Pathname.new(MYDIR).join('..', '..', 'lib').cleanpath.to_s -$LOAD_PATH.unshift MYDIR, LIBDIR -require 'basic' -require 'load_plugin_scanner' -require 'word_list' +$: << 'lib' +require 'coderay' +puts "Running basic CodeRay #{CodeRay::VERSION} tests..." + +suite = %w(basic load_plugin_scanner word_list) +for test_case in suite + load File.join(MYDIR, test_case + '.rb') +end diff --git a/test/functional/word_list.rb b/test/functional/word_list.rb index 04f4a02..84d6e9e 100644 --- a/test/functional/word_list.rb +++ b/test/functional/word_list.rb @@ -1,5 +1,5 @@ -require "test/unit" -require "coderay" +require 'test/unit' +require 'coderay' class WordListTest < Test::Unit::TestCase diff --git a/test/lib/README b/test/lib/README index dd18540..7d7a0a0 100644 --- a/test/lib/README +++ b/test/lib/README @@ -1,2 +1,3 @@ Contents: -- test/unit: We need the old Test::Unit for the scanner test suite to work with Ruby 1.9. \ No newline at end of file +- test/unit: We need the old Test::Unit for the scanner test suite to work with Ruby 1.9. +- term/ansicolor: Used for colorful output of the scanner tests. \ No newline at end of file diff --git a/test/scanners/coderay_suite.rb b/test/scanners/coderay_suite.rb index 60f71be..3a98c6b 100644 --- a/test/scanners/coderay_suite.rb +++ b/test/scanners/coderay_suite.rb @@ -11,6 +11,8 @@ $:.unshift File.join($mydir, '..', 'lib') require 'term/ansicolor' unless ENV['nocolor'] +require 'test/unit' + if defined? Term::ANSIColor class String include Term::ANSIColor @@ -413,6 +415,13 @@ module CodeRay return false end File.open(actual_html, 'w') { |f| f.write highlighted } + if okay + debug = $DEBUG + $DEBUG = false + FileUtils.copy(actual_html, name + '.expected.html') + $DEBUG = debug + end + true end expected_html = name + '.expected.html' diff --git a/test/scanners/debug/class.expected.raydebug b/test/scanners/debug/class.expected.raydebug index 501c99f..a53cdd6 100644 --- a/test/scanners/debug/class.expected.raydebug +++ b/test/scanners/debug/class.expected.raydebug @@ -12,3 +12,4 @@ < !! Folder )inline operator(+) ident(name)delimiter(})>content( not found --- > !! Folder )inline operator(+) ident(name)inline_delimiter(})>content( not found +) \ No newline at end of file diff --git a/test/scanners/php/namespaces.expected.raydebug b/test/scanners/php/namespaces.expected.raydebug new file mode 100644 index 0000000..47074a9 --- /dev/null +++ b/test/scanners/php/namespaces.expected.raydebug @@ -0,0 +1,9 @@ +inline_delimiter() diff --git a/test/scanners/php/namespaces.in.php b/test/scanners/php/namespaces.in.php new file mode 100644 index 0000000..ad6a1a1 --- /dev/null +++ b/test/scanners/php/namespaces.in.php @@ -0,0 +1,9 @@ + -- cgit v1.2.1