diff options
author | murphy <murphy@rubychan.de> | 2008-12-25 01:22:30 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2008-12-25 01:22:30 +0000 |
commit | 79a313948f2277cf0f2e238d5765a71fee03e089 (patch) | |
tree | 7f6c2de879231f1b7a30d9ba481984e79fede9c1 /test/functional | |
parent | bca06f1ec361537c4c7f1368ca8838be2940dafe (diff) | |
download | coderay-79a313948f2277cf0f2e238d5765a71fee03e089.tar.gz |
Fixes for Ruby 1.9.
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/basic.rb | 40 | ||||
-rwxr-xr-x | test/functional/suite.rb | 2 |
2 files changed, 25 insertions, 17 deletions
diff --git a/test/functional/basic.rb b/test/functional/basic.rb index 8f9e523..d629bd5 100755 --- a/test/functional/basic.rb +++ b/test/functional/basic.rb @@ -34,32 +34,40 @@ class BasicTest < Test::Unit::TestCase CodeRay::Duo[:plain, :plain].highlight(RUBY_TEST_CODE, :stream => true)) end - def test_for_redcloth + begin 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\">\"</span><span style=\"\">Hello, World!</span><span style=\"color:#710\">\"</span></span></span></p>", - RedCloth.new('@[ruby]puts "Hello, World!"@').to_html - assert_equal <<-BLOCKCODE.chomp, + gem 'RedCloth', '>= 4.0.3' rescue nil + require 'redcloth' + + 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\">\"</span><span style=\"\">Hello, World!</span><span style=\"color:#710\">\"</span></span></span></p>", + RedCloth.new('@[ruby]puts "Hello, World!"@').to_html + assert_equal <<-BLOCKCODE.chomp, <div lang="ruby" class="CodeRay"> <div class="code"><pre>puts <span style="background-color:#fff0f0;color:#D20"><span style="color:#710">"</span><span style="">Hello, World!</span><span style="color:#710">"</span></span></pre></div> </div> </pre> -BLOCKCODE - RedCloth.new('bc[ruby]. puts "Hello, World!"').to_html - end + BLOCKCODE + RedCloth.new('bc[ruby]. puts "Hello, World!"').to_html + end - def test_for_redcloth_escapes - require 'rubygems' - require 'coderay/for_redcloth' - assert_equal '<p><span lang="ruby" class="CodeRay">></span></p>', - RedCloth.new('@[ruby]>@').to_html - assert_equal <<-BLOCKCODE.chomp, + def test_for_redcloth_escapes + require 'rubygems' + require 'coderay/for_redcloth' + assert_equal '<p><span lang="ruby" class="CodeRay">></span></p>', + RedCloth.new('@[ruby]>@').to_html + assert_equal <<-BLOCKCODE.chomp, <div lang="ruby" class="CodeRay"> <div class="code"><pre>&</pre></div> </div> </pre> -BLOCKCODE - RedCloth.new('bc[ruby]. &').to_html + BLOCKCODE + RedCloth.new('bc[ruby]. &').to_html + end + rescue LoadError + $stderr.puts 'RedCloth not found.' end ENCODERS_LIST = %w( diff --git a/test/functional/suite.rb b/test/functional/suite.rb index 46316d8..e187677 100755 --- a/test/functional/suite.rb +++ b/test/functional/suite.rb @@ -2,7 +2,7 @@ require 'test/unit' require 'pathname' MYDIR = File.dirname(__FILE__) -LIBDIR = Pathname.new(MYDIR).join('..', '..', 'lib').cleanpath +LIBDIR = Pathname.new(MYDIR).join('..', '..', 'lib').cleanpath.to_s $LOAD_PATH.unshift MYDIR, LIBDIR require 'basic' |