summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2011-08-20 17:09:50 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2011-08-20 17:09:50 +0200
commit0c9418057607d6aaf11754978662dfb60b3865fa (patch)
tree558b8ce33309de9ef28ad901459d96ddf1c46bf5 /test
parentc073e4d256354d0d25fa65d1bfb0ab754198ff0a (diff)
downloadcoderay-0c9418057607d6aaf11754978662dfb60b3865fa.tar.gz
cleanup CodeRay.scan* methods
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/basic.rb4
-rw-r--r--test/unit/duo.rb28
2 files changed, 25 insertions, 7 deletions
diff --git a/test/functional/basic.rb b/test/functional/basic.rb
index 1702e4e..2654359 100755
--- a/test/functional/basic.rb
+++ b/test/functional/basic.rb
@@ -213,9 +213,7 @@ more code # and another comment, in-line.
def test_scanner_tokenize
assert_equal ['foo', :plain], CodeRay::Scanners::Plain.new.tokenize('foo')
assert_equal [['foo', :plain], ['bar', :plain]], CodeRay::Scanners::Plain.new.tokenize(['foo', 'bar'])
- assert_raise ArgumentError do
- CodeRay::Scanners::Plain.new.tokenize 42
- end
+ CodeRay::Scanners::Plain.new.tokenize 42
end
def test_scanner_tokens
diff --git a/test/unit/duo.rb b/test/unit/duo.rb
index e7f3f91..62bd57b 100644
--- a/test/unit/duo.rb
+++ b/test/unit/duo.rb
@@ -16,10 +16,30 @@ class DuoTest < Test::Unit::TestCase
end
def test_call
- duo = CodeRay::Duo[:python => :xml]
- assert_equal <<-'XML'.chomp, duo.call('def test: "pass"')
-<?xml version='1.0'?><coderay-tokens><keyword>def</keyword> <method>test</method><operator>:</operator> <string><delimiter>&quot;</delimiter><content>pass</content><delimiter>&quot;</delimiter></string></coderay-tokens>
- XML
+ 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
end
end