summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Rakefile2
-rw-r--r--lib/README1
-rw-r--r--lib/coderay/for_redcloth.rb1
-rw-r--r--rake_tasks/test.rake16
-rwxr-xr-xtest/functional/basic.rb22
5 files changed, 40 insertions, 2 deletions
diff --git a/Rakefile b/Rakefile
index 0537521..b1cdcb1 100644
--- a/Rakefile
+++ b/Rakefile
@@ -44,10 +44,12 @@ end
task 'jruby' do
RUBY.replace 'jruby'
end
+task :j => :jruby
task 'jruby19' do
RUBY.replace 'jruby --1.9'
end
+task :j19 => :jruby19
task 'rubinius' do
RUBY.replace 'rbx'
diff --git a/lib/README b/lib/README
index 6426958..2a558c3 100644
--- a/lib/README
+++ b/lib/README
@@ -88,6 +88,7 @@ Please report errors in this documentation to <murphy rubychan de>.
* Jonathan Younger for pointing out the licence confusion caused by wrong LICENSE file.
* Jeremy Hinegardner for finding the shebang-on-empty-file bug in FileType.
* Charles Oliver Nutter and Yehuda Katz for helping me benchmark CodeRay on JRuby.
+* Andreas Neuhaus for pointing out a markup bug in coderay/for_redcloth.
* The folks at redmine.org - thank you for using and fixing CodeRay!
* matz and all Ruby gods and gurus
* The inventors of: the computer, the internet, the true color display, HTML &
diff --git a/lib/coderay/for_redcloth.rb b/lib/coderay/for_redcloth.rb
index dde00cc..f5dcf3f 100644
--- a/lib/coderay/for_redcloth.rb
+++ b/lib/coderay/for_redcloth.rb
@@ -48,6 +48,7 @@ module CodeRay
opts[:lang] ? '' : "<pre#{pba(opts)}>"
end
def bc_close(opts) # :nodoc:
+ opts = @in_bc
@in_bc = nil
opts[:lang] ? '' : "</pre>\n"
end
diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake
index 20f32d8..2d05d3c 100644
--- a/rake_tasks/test.rake
+++ b/rake_tasks/test.rake
@@ -9,6 +9,22 @@ namespace :test do
ruby "./test/functional/suite.rb"
end
+ namespace :functional do
+ desc 'run all functional tests on all supported Ruby platforms'
+ task :all do
+ $stdout.sync = true
+ for task in %w(test:functional 19 test:functional jruby test:functional ee test:functional)
+ if task == 'test:functional'
+ puts "\n\nTesting with #{RUBY}..."
+ Rake::Task['test:functional'].reenable
+ Rake::Task['test:functional'].invoke
+ else
+ Rake::Task[task].invoke
+ end
+ end
+ end
+ end
+
desc 'run all scanner tests'
task :scanners do
ruby "./test/scanners/suite.rb"
diff --git a/test/functional/basic.rb b/test/functional/basic.rb
index d629bd5..d2bc9f1 100755
--- a/test/functional/basic.rb
+++ b/test/functional/basic.rb
@@ -48,11 +48,30 @@ class BasicTest < Test::Unit::TestCase
<div lang="ruby" class="CodeRay">
<div class="code"><pre>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></pre></div>
</div>
-</pre>
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'
@@ -62,7 +81,6 @@ class BasicTest < Test::Unit::TestCase
<div lang="ruby" class="CodeRay">
<div class="code"><pre>&amp;</pre></div>
</div>
-</pre>
BLOCKCODE
RedCloth.new('bc[ruby]. &').to_html
end