From 988f26fae6f7b7e7e366eeb8d28c91148853c314 Mon Sep 17 00:00:00 2001 From: murphy Date: Sun, 18 Oct 2009 17:18:05 +0000 Subject: Testing for_redcloth and lines_of_code. --- test/functional/basic.rb | 49 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/test/functional/basic.rb b/test/functional/basic.rb index bdb8608..bbf6d7a 100755 --- a/test/functional/basic.rb +++ b/test/functional/basic.rb @@ -63,6 +63,31 @@ code # A single-line comment. more code # and another comment, in-line. INPUT + rHTML = <<-RHTML + + + + + + <%= controller.controller_name.titleize %>: <%= controller.action_name %> + <%= stylesheet_link_tag 'scaffold' %> + + + +

<%= flash[:notice] %>

+ +
+ <%= yield %> +
+ + + + RHTML + assert_equal 0, CodeRay.scan(rHTML, :html).lines_of_code + assert_equal 0, CodeRay.scan(rHTML, :php).lines_of_code + assert_equal 0, CodeRay.scan(rHTML, :yaml).lines_of_code + assert_equal 4, CodeRay.scan(rHTML, :rhtml).lines_of_code end begin @@ -73,7 +98,7 @@ more code # and another comment, in-line. def test_for_redcloth require 'rubygems' require 'coderay/for_redcloth' - assert_equal "

puts \"Hello, World!\"

", + assert_equal "

puts "Hello, World!"

", RedCloth.new('@[ruby]puts "Hello, World!"@').to_html assert_equal <<-BLOCKCODE.chomp,
@@ -115,6 +140,28 @@ more code # and another comment, in-line. BLOCKCODE RedCloth.new('bc[ruby]. &').to_html end + + def test_for_redcloth_escapes2 + require 'rubygems' + require 'coderay/for_redcloth' + assert_equal "

#include <test.h>

", + RedCloth.new('@[c]#include @').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 '

[project]_dff.skjd

', + RedCloth.new('@[project]_dff.skjd@').to_html + # false positive, but expected behavior / known issue + assert_equal "

_dff.skjd

", + RedCloth.new('@[ruby]_dff.skjd@').to_html + assert_equal <<-BLOCKCODE.chomp, +
[project]_dff.skjd
+ BLOCKCODE + RedCloth.new('bc. [project]_dff.skjd').to_html + end rescue LoadError $stderr.puts 'RedCloth not found - skipping for_redcloth tests.' end -- cgit v1.2.1