-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b8d08c
commit e893ff6
Showing
7 changed files
with
75 additions
and
167 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
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
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
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
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
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 |
---|---|---|
@@ -1,40 +1,40 @@ | ||
import test from 'ava'; | ||
import { ReadPlugin } from '../src/plugin.js'; | ||
import { Plugin } from '../src/plugin.js'; | ||
import { Slangroom } from '../src/slangroom.js'; | ||
|
||
test("Runs all unknown statements", async (t) => { | ||
let useR1 = false; | ||
let useR2 = false; | ||
let useR3 = false; | ||
const r1 = new ReadPlugin("a", [], (...[]) => { | ||
const r1 = new Plugin("a", [], (...[]) => { | ||
useR1 = true; | ||
return "foo" | ||
}) | ||
const r2 = new ReadPlugin("b", ["a"], (...[output]) => { | ||
const r2 = new Plugin("b", ["a"], (...[a]) => { | ||
useR2 = true | ||
t.is(output, "foo") | ||
t.is(a, "foo") | ||
return "bar" | ||
}) | ||
const r3 = new ReadPlugin("c d", ["a"], (...[output]) => { | ||
const r3 = new Plugin("c d", ["a"], (...[a]) => { | ||
useR3 = true | ||
t.is(output, "bar") | ||
t.is(a, "bar") | ||
return "foobar" | ||
}) | ||
const script = ` | ||
Rule caller restroom-mw | ||
Given I read A | ||
Given I A and output into 'a' | ||
Given I have a 'string' named 'a' | ||
Then print 'a' | ||
Then I pass 'a' and read B | ||
Then I pass a 'b' and read c D | ||
Then I pass a 'b' and read C d into 'mimmo' | ||
Then I pass a 'a' and B and output into 'b' | ||
Then I pass a 'b' and c D | ||
Then I pass a 'b' and C d and output into 'mimmo' | ||
` | ||
const slangroom = new Slangroom(r1, r2, r3); | ||
const slangroom = new Slangroom(r1, [r2, r3]); | ||
const res = await slangroom.execute(script, {}) | ||
t.truthy(useR1, "r1 is not used") | ||
t.truthy(useR2, "r2 is not used") | ||
t.truthy(useR3, "r3 is not used") | ||
t.deepEqual(res.result, { a: 'foo', b: 'bar', c_d: 'foobar', mimmo: 'foobar' }, res.logs) | ||
t.deepEqual(res.result, { a: 'foo', b: 'bar', mimmo: 'foobar' }, res.logs) | ||
}) |
Oops, something went wrong.