Chris@210: require 'test/unit' Chris@210: $:.unshift 'lib' Chris@210: require 'coderay' Chris@210: Chris@210: begin Chris@210: require 'rubygems' unless defined? Gem Chris@210: gem 'RedCloth', '>= 4.0.3' rescue nil Chris@210: require 'redcloth' Chris@210: rescue LoadError Chris@210: warn 'RedCloth not found - skipping for_redcloth tests.' Chris@210: end Chris@210: Chris@210: class BasicTest < Test::Unit::TestCase Chris@210: Chris@210: def test_for_redcloth Chris@210: require 'coderay/for_redcloth' Chris@210: assert_equal "
puts "Hello, World!"
", Chris@210: RedCloth.new('@[ruby]puts "Hello, World!"@').to_html Chris@210: assert_equal <<-BLOCKCODE.chomp, Chris@210:puts "Hello, World!"
puts \"Hello, World!\"
puts \"Hello, World!\"
Chris@210: BLOCKCODE
Chris@210: RedCloth.new('bc. puts "Hello, World!"').to_html
Chris@210: end
Chris@210:
Chris@210: def test_for_redcloth_style
Chris@210: require 'coderay/for_redcloth'
Chris@210: assert_equal <<-BLOCKCODE.chomp,
Chris@210: puts \"Hello, World!\"
Chris@210: BLOCKCODE
Chris@210: RedCloth.new('bc{color: red}. puts "Hello, World!"').to_html
Chris@210: end
Chris@210:
Chris@210: def test_for_redcloth_escapes
Chris@210: require 'coderay/for_redcloth'
Chris@210: assert_equal '>
', Chris@210: RedCloth.new('@[ruby]>@').to_html Chris@210: assert_equal <<-BLOCKCODE.chomp, Chris@210:&
#include <test.h>
", Chris@210: RedCloth.new('@[c]#include[project]_dff.skjd
_dff.skjd
", Chris@210: RedCloth.new('@[ruby]_dff.skjd@').to_html Chris@210: assert_equal <<-BLOCKCODE.chomp, Chris@210:[project]_dff.skjd
Chris@210: BLOCKCODE
Chris@210: RedCloth.new('bc. [project]_dff.skjd').to_html
Chris@210: end
Chris@210:
Chris@210: end if defined? RedCloth