diff options
Diffstat (limited to 'test/unit/duo.rb')
-rw-r--r-- | test/unit/duo.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/unit/duo.rb b/test/unit/duo.rb new file mode 100644 index 0000000..a433c3e --- /dev/null +++ b/test/unit/duo.rb @@ -0,0 +1,45 @@ +require 'test/unit' +require 'coderay' + +class DuoTest < Test::Unit::TestCase + + def test_two_arguments + duo = CodeRay::Duo[:ruby, :html] + assert_kind_of CodeRay::Scanners[:ruby], duo.scanner + assert_kind_of CodeRay::Encoders[:html], duo.encoder + end + + def test_two_hash + duo = CodeRay::Duo[:ruby => :html] + assert_kind_of CodeRay::Scanners[:ruby], duo.scanner + assert_kind_of CodeRay::Encoders[:html], duo.encoder + end + + def test_call + duo = CodeRay::Duo[:python => :yaml] + 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 + end + +end |