Skip to content

Commit b6f1e97

Browse files
committed
Adding a regression test of parsingContext option of vm.compileFunction().
1 parent e8e0641 commit b6f1e97

File tree

1 file changed

+9
-1
lines changed
  • graal-nodejs/test/graal/unit

1 file changed

+9
-1
lines changed

graal-nodejs/test/graal/unit/vm.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -88,4 +88,12 @@ describe('vm', function () {
8888
}, SyntaxError);
8989
assert.strictEqual(new vm.Script('6*7', { filename: 'vm.js' }).runInThisContext(), 42);
9090
});
91+
it('should honor parsingContext option of compileFunction()', function () {
92+
// Extracted from parallel/test-vm-basic.js.
93+
// Similar pattern is used by jest testing framework.
94+
assert.strictEqual(
95+
vm.compileFunction('return varInContext', [], { parsingContext: vm.createContext({varInContext: 'abc'}) })(),
96+
'abc'
97+
);
98+
});
9199
});

0 commit comments

Comments
 (0)