~yolanda.robla/ubuntu/trusty/nodejs/add_distribution

« back to all changes in this revision

Viewing changes to test/simple/test-script-context.js

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2013-08-14 00:16:46 UTC
  • mfrom: (7.1.40 sid)
  • Revision ID: package-import@ubuntu.com-20130814001646-bzlysfh8sd6mukbo
Tags: 0.10.15~dfsg1-4
* Update 2005 patch, adding a handful of tests that can fail on
  slow platforms.
* Add 1004 patch to fix test failures when writing NaN to buffer
  on mipsel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
assert.equal(3, context.foo);
43
43
assert.equal('lala', context.thing);
44
44
 
45
 
 
46
45
// Issue GH-227:
47
46
Script.runInNewContext('', null, 'some.js');
48
47
 
65
64
  return o instanceof TypeError;
66
65
}
67
66
 
68
 
[undefined, null, 0, 0.0, '', {}, []].forEach(function(e) {
 
67
([undefined, null, 0, 0.0, '', {}, []].forEach(function(e) {
69
68
  assert.throws(function() { script.runInContext(e); }, isTypeError);
70
69
  assert.throws(function() { vm.runInContext('', e); }, isTypeError);
71
 
});
 
70
}));
 
71
 
 
72
// Issue GH-693:
 
73
common.debug('test RegExp as argument to assert.throws');
 
74
script = vm.createScript('var assert = require(\'assert\'); assert.throws(' +
 
75
                         'function() { throw "hello world"; }, /hello/);',
 
76
                         'some.js');
 
77
script.runInNewContext({ require : require });