diff --git a/tests/snapshot-throw.js b/tests/snapshot-throw.js deleted file mode 100644 index cbf8df2a..00000000 --- a/tests/snapshot-throw.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; -try { - require("isolated-vm").Isolate.createSnapshot([ { code: '**' } ]); -} catch (err) { - console.log('pass'); -} diff --git a/tests/snapshot.js b/tests/snapshot.js deleted file mode 100644 index a8e9399c..00000000 --- a/tests/snapshot.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -const ivm = require('isolated-vm'); -const assert = require('assert'); - -let code = 'function sum(a,b) { return a + b }\n'; -if (process.versions.modules >= 64) { - code += 'const array = new Uint32Array(128); array[100] = 0xdeadbeef;\n'; -} -let snapshot = ivm.Isolate.createSnapshot([ { code } ]); -let isolate = new ivm.Isolate({ snapshot }); -/* try { - snapshot.copy({ transferIn: true }); - assert.fail('buffer transferred'); -} catch (err) { - assert.ok(/in use/.test(err), 'weird error'); -} */ -let context = isolate.createContextSync(); -assert.equal(isolate.compileScriptSync('sum(1, 2)').runSync(context), 3); -if (process.versions.modules >= 64) { - assert.equal(isolate.compileScriptSync('array[100]').runSync(context), 0xdeadbeef); -} - -{ - let snapshot = ivm.Isolate.createSnapshot([{ - code: `utf8 = 'è';` - }]); - let isolate = new ivm.Isolate({ snapshot }); - let context = isolate.createContextSync(); - assert.equal(context.global.getSync('utf8'), 'è'); -} - -console.log('pass');