diff options
author | murphy <murphy@rubychan.de> | 2009-02-18 19:39:26 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2009-02-18 19:39:26 +0000 |
commit | df8bccf987e636d442e43f8c704d750f6519bd3f (patch) | |
tree | 392bef3e25fc876b94bb5cc552033f3d9e24d5d3 | |
parent | 89c23fd2685f0a99993877ad7a0a576d56e75c62 (diff) | |
download | coderay-df8bccf987e636d442e43f8c704d750f6519bd3f.tar.gz |
Fixed a bug in for_redcloth.rb (closes #87).
* No more closing PRE tags in RedCloth output.
* Added j, j19, and test:functional:all tasks.
-rw-r--r-- | Rakefile | 2 | ||||
-rw-r--r-- | lib/README | 1 | ||||
-rw-r--r-- | lib/coderay/for_redcloth.rb | 1 | ||||
-rw-r--r-- | rake_tasks/test.rake | 16 | ||||
-rwxr-xr-x | test/functional/basic.rb | 22 |
5 files changed, 40 insertions, 2 deletions
@@ -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' @@ -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">"</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 + 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>&</pre></div> </div> -</pre> BLOCKCODE RedCloth.new('bc[ruby]. &').to_html end |