Skip to content

Commit e0b08d7

Browse files
committed
add simple spec for CodeRay.scan
1 parent f3b1f3d commit e0b08d7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec/coderay_spec.rb

+19
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,23 @@
1313
expect(CodeRay.coderay_path('file')).to eq("#{base}/lib/coderay/file")
1414
end
1515
end
16+
17+
describe '.scan' do
18+
let(:code) { 'puts "Hello, World!"' }
19+
let(:tokens) do
20+
[
21+
['puts', :ident],
22+
[' ', :space],
23+
[:begin_group, :string],
24+
['"', :delimiter],
25+
['Hello, World!', :content],
26+
['"', :delimiter],
27+
[:end_group, :string]
28+
].flatten
29+
end
30+
31+
it 'returns tokens' do
32+
expect(CodeRay.scan(code, :ruby).tokens).to eq(tokens)
33+
end
34+
end
1635
end

0 commit comments

Comments
 (0)