summaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-03-31 22:17:06 +0000
committermurphy <murphy@rubychan.de>2010-03-31 22:17:06 +0000
commit862bc9aa6b002f6b29cf74f93ca66e63cf370819 (patch)
tree45e8a8731fadca8df5fe86595dc2e8f6dc7a3782 /test/functional
parentcce5dad0dce285a2b7c4f1fe0ec79d10c71a8403 (diff)
downloadcoderay-862bc9aa6b002f6b29cf74f93ca66e63cf370819.tar.gz
Upporting changes from 0.9.2 (vs. 0.9.1).
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/basic.rb6
-rw-r--r--test/functional/for_redcloth.rb20
-rwxr-xr-xtest/functional/load_plugin_scanner.rb4
-rwxr-xr-xtest/functional/suite.rb14
-rw-r--r--test/functional/word_list.rb4
5 files changed, 20 insertions, 28 deletions
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 "<p><span lang=\"ruby\" class=\"CodeRay\">puts <span style=\"background-color:#fff0f0;color:#D20\"><span style=\"color:#710\">&quot;</span><span style=\"\">Hello, World!</span><span style=\"color:#710\">&quot;</span></span></span></p>",
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 "<p><code>puts \"Hello, World!\"</code></p>",
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,
<pre style=\"color: red;\"><code style=\"color: red;\">puts \"Hello, World!\"</code></pre>
@@ -50,7 +43,6 @@ class BasicTest < Test::Unit::TestCase
end
def test_for_redcloth_escapes
- require 'rubygems'
require 'coderay/for_redcloth'
assert_equal '<p><span lang="ruby" class="CodeRay">&gt;</span></p>',
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 "<p><span lang=\"c\" class=\"CodeRay\"><span style=\"color:#579\">#include</span> <span style=\"color:#B44;font-weight:bold\">&lt;test.h&gt;</span></span></p>",
RedCloth.new('@[c]#include <test.h>@').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 '<p><code>[project]_dff.skjd</code></p>',
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