diff options
Diffstat (limited to 'lib/coderay/encoders')
-rw-r--r-- | lib/coderay/encoders/text.rb | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/coderay/encoders/text.rb b/lib/coderay/encoders/text.rb index 2dfb224..c146038 100644 --- a/lib/coderay/encoders/text.rb +++ b/lib/coderay/encoders/text.rb @@ -1,3 +1,4 @@ +($:.unshift '../..'; require 'coderay') unless defined? CodeRay module CodeRay module Encoders @@ -19,11 +20,12 @@ module Encoders FILE_EXTENSION = 'txt' DEFAULT_OPTIONS = { - :separator => '' + :separator => nil } def text_token text, kind - @out << text + @sep + @out << text + @out << @sep if @sep end protected @@ -40,3 +42,24 @@ module Encoders end end + +if $0 == __FILE__ + $VERBOSE = true + $: << File.join(File.dirname(__FILE__), '..') + eval DATA.read, nil, $0, __LINE__ + 4 +end + +__END__ +require 'test/unit' + +class CountTest < Test::Unit::TestCase + + def test_count + ruby = <<-RUBY +puts "Hello world!" + RUBY + tokens = CodeRay.scan ruby, :ruby + assert_equal ruby, tokens.encode_with(:text) + end + +end
\ No newline at end of file |