Add tests for Node port export functions
@@ -69,6 +69,14 @@ describe('metacall', () => {
assert.notStrictEqual(script, undefined);
assert.strictEqual(script.name, 'helloworld.py');
});
+ it('metacall_load_from_file_export (py)', () => {
+ const handle = metacall_load_from_file_export('py', [ 'ducktype.py' ] );
+ assert.notStrictEqual(handle, undefined);
+ assert.strictEqual(handle.sum(1, 2), 3);
+
+ // TODO: Need a way to test the symbol is not globally defined.
+ //assert.strictEqual(metacall('sum'), undefined);
+ });
it('metacall_load_from_file (rb)', () => {
assert.strictEqual(metacall_load_from_file('rb', [ 'ducktype.rb' ]), undefined);
@@ -80,6 +88,14 @@ describe('metacall', () => {
assert.strictEqual(metacall_load_from_memory('py', 'def py_memory():\n\treturn 4;\n'), undefined);
assert.strictEqual(metacall('py_memory'), 4.0);
});
+ it('metacall_load_from_memory_export (py)', () => {
+ const handle = metacall_load_from_memory_export('py', 'def py_memory_export():\n\treturn 6;\n');
+ assert.notStrictEqual(handle, undefined);
+ assert.strictEqual(handle.py_memory_export(), 6.0);
+
+ // TODO: Need a way to test the symbol is not globally defined.
+ //assert.strictEqual(metacall('py_memory_export'), undefined);
+ });
// Cobol tests are conditional (in order to pass CI/CD)
if (process.env['OPTION_BUILD_LOADERS_COB']) {
it('metacall_load_from_file (cob)', () => {
