From df8bccf987e636d442e43f8c704d750f6519bd3f Mon Sep 17 00:00:00 2001 From: murphy Date: Wed, 18 Feb 2009 19:39:26 +0000 Subject: 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. --- Rakefile | 2 ++ lib/README | 1 + lib/coderay/for_redcloth.rb | 1 + rake_tasks/test.rake | 16 ++++++++++++++++ test/functional/basic.rb | 22 ++++++++++++++++++++-- 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 . * 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] ? '' : "" end def bc_close(opts) # :nodoc: + opts = @in_bc @in_bc = nil opts[:lang] ? '' : "\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
puts "Hello, World!"
- 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 "

puts \"Hello, World!\"

", + RedCloth.new('@puts "Hello, World!"@').to_html + assert_equal <<-BLOCKCODE.chomp, +
puts \"Hello, World!\"
+ 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, +
puts \"Hello, World!\"
+ 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
&
- BLOCKCODE RedCloth.new('bc[ruby]. &').to_html end -- cgit v1.2.1