summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2009-06-29 23:18:44 +0000
committermurphy <murphy@rubychan.de>2009-06-29 23:18:44 +0000
commit35ba94fe6ba3fa9aa9dce364521417b7cbbb7b94 (patch)
treebeee68c9bdf278ed907457b6f30d95ee1e31f099 /test
parent00966d3cd17d5c9f07990d3e9628767ac5a867b6 (diff)
downloadcoderay-35ba94fe6ba3fa9aa9dce364521417b7cbbb7b94.tar.gz
Added LinesOfCode encoder (issue #123) - simple version.
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/basic.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/basic.rb b/test/functional/basic.rb
index ed4b3cc..bdb8608 100755
--- a/test/functional/basic.rb
+++ b/test/functional/basic.rb
@@ -35,6 +35,36 @@ class BasicTest < Test::Unit::TestCase
CodeRay::Duo[:plain, :plain].highlight(RUBY_TEST_CODE, :stream => true))
end
+ def test_comment_filter
+ assert_equal <<-EXPECTED, CodeRay.scan(<<-INPUT, :ruby).comment_filter.text
+#!/usr/bin/env ruby
+
+code
+
+more code
+ EXPECTED
+#!/usr/bin/env ruby
+=begin
+A multi-line comment.
+=end
+code
+# A single-line comment.
+more code # and another comment, in-line.
+ INPUT
+ end
+
+ def test_lines_of_code
+ assert_equal 2, CodeRay.scan(<<-INPUT, :ruby).lines_of_code
+#!/usr/bin/env ruby
+=begin
+A multi-line comment.
+=end
+code
+# A single-line comment.
+more code # and another comment, in-line.
+ INPUT
+ end
+
begin
require 'rubygems'
gem 'RedCloth', '>= 4.0.3' rescue nil