Skip to content

Commit

Permalink
Merge pull request #3 from Agoric/indirect-eval
Browse files Browse the repository at this point in the history
ses-test: reenable indirect eval
  • Loading branch information
michaelfig authored Jul 24, 2019
2 parents c217a79 + b6a7818 commit 7c1f575
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 32 deletions.
18 changes: 13 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"prettier": "^1.16.4",
"rollup": "^1.16.6",
"rollup-plugin-node-resolve": "^5.2.0",
"ses": "^0.5.1",
"ses": "^0.5.3",
"tap-spec": "^5.0.0",
"tape": "^4.9.2",
"tape-promise": "^4.0.0"
Expand Down
35 changes: 9 additions & 26 deletions test/ses-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ test('infix bang is disabled by default', t => {
SyntaxError,
`infix bang fails`,
);
if (false) {
// FIXME: (1 , eval) is not a function.
t.equals(s.evaluate('(1,eval)("123")'), 123, `indirect eval works`);
}
t.equals(s.evaluate('(1,eval)("123")'), 123, `indirect eval works`);
} catch (e) {
t.assert(false, e);
} finally {
Expand Down Expand Up @@ -154,29 +151,15 @@ test('infix bang can be enabled', async t => {
),
);

let indirEval = noReject;
if (true) {
// FIXME: Should be noReject.
indirEval = fn =>
t.rejects(
fn(),
/\(1 , eval\) is not a function/,
`${name} indirect eval fails (FIXME)`,
);
}
await indirEval(async () =>
t.equals(
await s.evaluate(`(1,eval)('"abc"!length')`),
3,
`${name} indirect eval works`,
),
t.equals(
await s.evaluate(`(1,eval)('"abc"!length')`),
3,
`${name} indirect eval works`,
);
await indirEval(async () =>
t.equals(
await s.evaluate(`(1,eval)('(1,eval)(\\'"abc"!length\\')')`),
3,
`${name} nested indirect eval works`,
),
t.equals(
await s.evaluate(`(1,eval)('(1,eval)(\\'"abc"!length\\')')`),
3,
`${name} nested indirect eval works`,
);
}
} catch (e) {
Expand Down

0 comments on commit 7c1f575

Please sign in to comment.