Skip to content

Commit

Permalink
more grammar transform tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dhowe committed Sep 5, 2020
1 parent d90f6e4 commit 248b7d1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/grammar-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ describe('RiTa.Grammar', () => {
rg.addRule("$animal", "$pet");
rg.addRule("$pet", "(dog).toUpperCase()");
eq(rg.expand(), "DOG");

rg = new Grammar();
rg.addRule("$start", "($pet | $animal)");
rg.addRule("$animal", "$pet");
rg.addRule("$pet", "(ant).articlize()");
eq(rg.expand(), "an ant");

rg = new Grammar();
rg.addRule("$start", "($pet | $animal).articlize().ucf()");
rg.addRule("$animal", "$pet");
rg.addRule("$pet", "ant");
eq(rg.expand(), "An ant");
});

it("should pluralize phrases in a transform", () => {
Expand Down

0 comments on commit 248b7d1

Please sign in to comment.