summaryrefslogtreecommitdiff
path: root/test/unit/duo.rb
blob: a433c3e81e4280704dadd84bf6dc28c96b258a73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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