-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests of concatenated rule parsing with delimeters
- Loading branch information
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
describe Calyx::Production::Concat do | ||
it 'treats input with no delimiters as a concatenated production with a single atom' do | ||
registry = double('registry') | ||
concat = Calyx::Production::Concat.parse('one two three', registry) | ||
expect(concat.evaluate).to eq([:concat, [[:atom, 'one two three']]]) | ||
end | ||
|
||
it 'treats input with delimiters as a concatenated production with an expansion' do | ||
registry = double('registry') | ||
allow(registry).to receive(:expand).and_return(Calyx::Production::Terminal.new('ONE')) | ||
concat = Calyx::Production::Concat.parse('{one} two three', registry) | ||
expect(concat.evaluate).to eq([:concat, [[:atom, ''], [:one, [:atom, 'ONE']], [:atom, ' two three']]]) | ||
end | ||
end |