summaryrefslogtreecommitdiff
path: root/spec/simple_scanner_spec.rb
blob: 088343cb4ac5b01502faf6b15eb2d89d8402dfd0 (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
RSpec.describe CodeRay::Scanners::SimpleScanner do
  let(:scanner) { Class.new described_class }

  describe '#scan_tokens_code' do
    subject { scanner.send :scan_tokens_code }
    it 'lets you define states' do
      is_expected.to eq <<-RUBY
state = options[:state] || @state
states = [state]


until eos?
  case state
    
  else
    raise_inspect 'Unknown state: %p' % [state], encoder
  end
end

@state = state if options[:keep_state]

close_groups(encoder, states)

encoder
      RUBY
    end
  end
end