diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2011-08-21 16:56:38 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2011-08-21 16:56:38 +0200 |
commit | cf26b52ac6224b91ffc3fb63bb29fb4922ce47c5 (patch) | |
tree | cca5d73274a9604c91c818ea36298138a2a9e062 | |
parent | fc509f3be65ff322ed460d4a5569952bb5973939 (diff) | |
download | coderay-cf26b52ac6224b91ffc3fb63bb29fb4922ce47c5.tar.gz |
fix YAML encoder for Psych (damn!)
-rw-r--r-- | lib/coderay/encoders/yaml.rb | 4 | ||||
-rw-r--r-- | test/unit/duo.rb | 36 |
2 files changed, 14 insertions, 26 deletions
diff --git a/lib/coderay/encoders/yaml.rb b/lib/coderay/encoders/yaml.rb index 69d397c..ba6e715 100644 --- a/lib/coderay/encoders/yaml.rb +++ b/lib/coderay/encoders/yaml.rb @@ -20,9 +20,7 @@ module Encoders end def finish options - ::YAML.dump @data, @out - - super + output ::YAML.dump(@data) end public diff --git a/test/unit/duo.rb b/test/unit/duo.rb index 62bd57b..05c26a5 100644 --- a/test/unit/duo.rb +++ b/test/unit/duo.rb @@ -1,4 +1,5 @@ require 'test/unit' +require 'yaml' require 'coderay' class DuoTest < Test::Unit::TestCase @@ -17,29 +18,18 @@ class DuoTest < Test::Unit::TestCase def test_call duo = CodeRay::Duo[:python => :yml] - assert_equal <<-'YAML', duo.call('def test: "pass"') ---- -- - def - - :keyword -- - " " - - :space -- - test - - :method -- - ":" - - :operator -- - " " - - :space -- - :begin_group - - :string -- - "\"" - - :delimiter -- - pass - - :content -- - "\"" - - :delimiter -- - :end_group - - :string - YAML + yaml = [["def", :keyword], + [" ", :space], + ["test", :method], + [":", :operator], + [" ", :space], + [:begin_group, :string], + ["\"", :delimiter], + ["pass", :content], + ["\"", :delimiter], + [:end_group, :string]] + + assert_equal yaml, YAML.load(duo.call('def test: "pass"')) end end |