Skip to content

Commit

Permalink
add simple spec for CodeRay.scan
Browse files Browse the repository at this point in the history
  • Loading branch information
korny committed Nov 24, 2019
1 parent f3b1f3d commit e0b08d7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/coderay_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,23 @@
expect(CodeRay.coderay_path('file')).to eq("#{base}/lib/coderay/file")
end
end

describe '.scan' do
let(:code) { 'puts "Hello, World!"' }
let(:tokens) do
[
['puts', :ident],
[' ', :space],
[:begin_group, :string],
['"', :delimiter],
['Hello, World!', :content],
['"', :delimiter],
[:end_group, :string]
].flatten
end

it 'returns tokens' do
expect(CodeRay.scan(code, :ruby).tokens).to eq(tokens)
end
end
end

0 comments on commit e0b08d7

Please sign in to comment.