diff options
| author | murphy <murphy@rubychan.de> | 2010-06-29 06:32:30 +0000 |
|---|---|---|
| committer | murphy <murphy@rubychan.de> | 2010-06-29 06:32:30 +0000 |
| commit | 93dfad17309f46d00d1043592efdb282d13963fe (patch) | |
| tree | 60cbfc2fbc3497f95f5d02de1e9ec8c7b10515ff /test/unit/duo.rb | |
| parent | 87764c224cc8c808688e83d7c1f93c8dbbbd9b4f (diff) | |
| download | coderay-93dfad17309f46d00d1043592efdb282d13963fe.tar.gz | |
Added lots of unit tests.
Theses actually come from the library files; now they are included. Also, rake test and test:all don't test the scanners now; you have to start them using rake test:scanners.
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 |
