annotate vendor/gems/coderay-0.9.7/lib/coderay/encoders/comment_filter.rb @ 441:cbce1fd3b1b7 redmine-1.2

Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author Chris Cannam
date Mon, 06 Jun 2011 14:24:13 +0100
parents 0579821a129a
children
rev   line source
Chris@0 1 ($:.unshift '../..'; require 'coderay') unless defined? CodeRay
Chris@0 2 module CodeRay
Chris@0 3 module Encoders
Chris@0 4
Chris@0 5 load :token_class_filter
Chris@0 6
Chris@0 7 class CommentFilter < TokenClassFilter
Chris@0 8
Chris@0 9 register_for :comment_filter
Chris@0 10
Chris@0 11 DEFAULT_OPTIONS = superclass::DEFAULT_OPTIONS.merge \
Chris@0 12 :exclude => [:comment]
Chris@0 13
Chris@0 14 end
Chris@0 15
Chris@0 16 end
Chris@0 17 end
Chris@0 18
Chris@0 19 if $0 == __FILE__
Chris@0 20 $VERBOSE = true
Chris@0 21 $: << File.join(File.dirname(__FILE__), '..')
Chris@0 22 eval DATA.read, nil, $0, __LINE__ + 4
Chris@0 23 end
Chris@0 24
Chris@0 25 __END__
Chris@0 26 require 'test/unit'
Chris@0 27
Chris@0 28 class CommentFilterTest < Test::Unit::TestCase
Chris@0 29
Chris@0 30 def test_filtering_comments
Chris@0 31 tokens = CodeRay.scan <<-RUBY, :ruby
Chris@0 32 #!/usr/bin/env ruby
Chris@0 33 # a minimal Ruby program
Chris@0 34 puts "Hello world!"
Chris@0 35 RUBY
Chris@0 36 assert_equal <<-RUBY_FILTERED, tokens.comment_filter.text
Chris@0 37 #!/usr/bin/env ruby
Chris@0 38
Chris@0 39 puts "Hello world!"
Chris@0 40 RUBY_FILTERED
Chris@0 41 end
Chris@0 42
Chris@0 43 end