diff options
Diffstat (limited to 'test/functional/basic.rb')
-rwxr-xr-x | test/functional/basic.rb | 78 |
1 files changed, 3 insertions, 75 deletions
diff --git a/test/functional/basic.rb b/test/functional/basic.rb index bbf6d7a..6eb9782 100755 --- a/test/functional/basic.rb +++ b/test/functional/basic.rb @@ -90,81 +90,9 @@ more code # and another comment, in-line. assert_equal 4, CodeRay.scan(rHTML, :rhtml).lines_of_code end - begin - require 'rubygems' - 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> - BLOCKCODE - RedCloth.new('bc[ruby]. puts "Hello, World!"').to_html - 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 - assert_equal <<-BLOCKCODE.chomp, -<pre><code>puts \"Hello, World!\"</code></pre> - BLOCKCODE - RedCloth.new('bc. puts "Hello, World!"').to_html - 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> - BLOCKCODE - RedCloth.new('bc{color: red}. 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, -<div lang="ruby" class="CodeRay"> - <div class="code"><pre>&</pre></div> -</div> - BLOCKCODE - RedCloth.new('bc[ruby]. &').to_html - 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\"><test.h></span></span></p>", - RedCloth.new('@[c]#include <test.h>@').to_html - end - - # 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 - # false positive, but expected behavior / known issue - assert_equal "<p><span lang=\"ruby\" class=\"CodeRay\">_dff.skjd</span></p>", - RedCloth.new('@[ruby]_dff.skjd@').to_html - assert_equal <<-BLOCKCODE.chomp, -<pre><code>[project]_dff.skjd</code></pre> - BLOCKCODE - RedCloth.new('bc. [project]_dff.skjd').to_html - end - rescue LoadError - $stderr.puts 'RedCloth not found - skipping for_redcloth tests.' - end + def test_rubygems_not_loaded + assert_equal nil, defined? Gem + end unless RUBY_VERSION >= '1.9' def test_list_of_encoders assert_kind_of(Array, CodeRay::Encoders.list) |