diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2019-11-24 17:01:34 +0100 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2019-11-24 17:01:34 +0100 |
commit | e0b08d754b205f9204415c8d08b93a30cb92c04b (patch) | |
tree | b8cba26f761aa7b3baa28501d312a9a5a740891f | |
parent | f3b1f3dc9dbf1145e3244c1cc6d81438c180ea29 (diff) | |
download | coderay-e0b08d754b205f9204415c8d08b93a30cb92c04b.tar.gz |
add simple spec for CodeRay.scan
-rw-r--r-- | spec/coderay_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/coderay_spec.rb b/spec/coderay_spec.rb index 8a299b3..88c9aec 100644 --- a/spec/coderay_spec.rb +++ b/spec/coderay_spec.rb @@ -13,4 +13,23 @@ RSpec.describe CodeRay do 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 |