3
describe Parslet::Atoms::Lookahead do
6
describe 'negative lookahead' do
7
it "influences the error tree" do
8
parser = str('f').absent? >> str('b')
9
cause = catch_failed_parse { parser.parse('f') }
11
cause.ascii_tree.should == "Failed to match sequence (!'f' 'b') at line 1 char 1.\n`- Input should not start with 'f' at line 1 char 1.\n"
14
describe 'positive lookahead' do
15
it "influences the error tree" do
16
parser = str('f').present? >> str('b')
17
cause = catch_failed_parse { parser.parse('b') }
19
cause.ascii_tree.should == "Failed to match sequence (&'f' 'b') at line 1 char 1.\n`- Input should start with 'f' at line 1 char 1.\n"
b'\\ No newline at end of file'