Test position validity for empty matching rules - #27

This commit is contained in:
josh committed 2024-07-21 13:39:30 -04:00
1 parent e647248e34
commit 092fce61eb
4 files changed
+227 -2

No files matched your search

+21 -1
View File
@@ -1081,7 +1081,7 @@ EOF
expect(results.status).to eq 0
end
it "stores the token position in the AST Token node" do
it "stores token and rule positions in AST nodes" do
write_grammar <<EOF
ast;
@@ -1100,6 +1100,26 @@ EOF
expect(results.stderr).to eq ""
expect(results.status).to eq 0
end
it "stores invalid positions for empty rule matches" do
write_grammar <<EOF
ast;
token a;
token bb;
token c /c(.|\\n)*c/;
drop /\\s+/;
Start -> T Start;
Start -> ;
T -> a A;
A -> bb? c?;
EOF
run_propane(language: language)
compile("spec/test_ast_invalid_positions.#{language}", language: language)
results = run_test
expect(results.stderr).to eq ""
expect(results.status).to eq 0
end
end
end
end