| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,25 +14,25 @@ assert.throws(function() { | |||
| 14 | 14 | vm.runInThisContext('throw new Error(\'test\');'); | |
| 15 | 15 | }, /test/); | |
| 16 | 16 | ||
| 17 | - hello = 5; | ||
| 17 | + global.hello = 5; | ||
| 18 | 18 | vm.runInThisContext('hello = 2'); | |
| 19 | - assert.equal(2, hello); | ||
| 19 | + assert.equal(2, global.hello); | ||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | 22 | console.error('pass values'); | |
| 23 | - code = 'foo = 1;' + | ||
| 23 | + var code = 'foo = 1;' + | ||
| 24 | 24 | 'bar = 2;' + | |
| 25 | 25 | 'if (typeof baz !== \'undefined\') throw new Error(\'test fail\');'; | |
| 26 | - foo = 2; | ||
| 27 | - obj = { foo: 0, baz: 3 }; | ||
| 26 | + global.foo = 2; | ||
| 27 | + global.obj = { foo: 0, baz: 3 }; | ||
| 28 | 28 | /* eslint-disable no-unused-vars */ | |
| 29 | 29 | var baz = vm.runInThisContext(code); | |
| 30 | 30 | /* eslint-enable no-unused-vars */ | |
| 31 | - assert.equal(0, obj.foo); | ||
| 32 | - assert.equal(2, bar); | ||
| 33 | - assert.equal(1, foo); | ||
| 31 | + assert.equal(0, global.obj.foo); | ||
| 32 | + assert.equal(2, global.bar); | ||
| 33 | + assert.equal(1, global.foo); | ||
| 34 | 34 | ||
| 35 | 35 | console.error('call a function'); | |
| 36 | - f = function() { foo = 100; }; | ||
| 36 | + global.f = function() { global.foo = 100; }; | ||
| 37 | 37 | vm.runInThisContext('f()'); | |
| 38 | - assert.equal(100, foo); | ||
| 38 | + assert.equal(100, global.foo); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments