mirror of https://github.com/lukechilds/node.git
isaacs
13 years ago
6 changed files with 163 additions and 27 deletions
@ -0,0 +1,53 @@ |
|||
|
|||
// Copyright Joyent, Inc. and other Node contributors.
|
|||
//
|
|||
// Permission is hereby granted, free of charge, to any person obtaining a
|
|||
// copy of this software and associated documentation files (the
|
|||
// "Software"), to deal in the Software without restriction, including
|
|||
// without limitation the rights to use, copy, modify, merge, publish,
|
|||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|||
// persons to whom the Software is furnished to do so, subject to the
|
|||
// following conditions:
|
|||
//
|
|||
// The above copyright notice and this permission notice shall be included
|
|||
// in all copies or substantial portions of the Software.
|
|||
//
|
|||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
|||
var common = require('../common'); |
|||
var assert = require('assert'); |
|||
|
|||
var spawn = require('child_process').spawn; |
|||
|
|||
function run(cmd, strict, cb) { |
|||
var args = []; |
|||
if (strict) args.push('--use_strict'); |
|||
args.push('-pe', cmd); |
|||
var child = spawn(process.execPath, args); |
|||
child.stdout.pipe(process.stdout); |
|||
child.stderr.pipe(process.stdout); |
|||
child.on('close', cb); |
|||
} |
|||
|
|||
var queue = |
|||
[ 'with(this){__filename}', |
|||
'42', |
|||
'throw new Error("hello")', |
|||
'var x = 100; y = x;', |
|||
'var ______________________________________________; throw 10' ]; |
|||
|
|||
function go() { |
|||
var c = queue.shift(); |
|||
if (!c) return console.log('done'); |
|||
run(c, false, function() { |
|||
run(c, true, go); |
|||
}); |
|||
} |
|||
|
|||
go(); |
@ -0,0 +1,58 @@ |
|||
[eval] |
|||
|
|||
[eval]:1 |
|||
with(this){__filename} |
|||
^^^^ |
|||
SyntaxError: Strict mode code may not include a with statement |
|||
at Object.<anonymous> ([eval]-wrapper:6:22) |
|||
at Module._compile (module.js:449:26) |
|||
at evalScript (node.js:282:25) |
|||
at startup (node.js:76:7) |
|||
at node.js:623:3 |
|||
42 |
|||
42 |
|||
|
|||
[eval]:1 |
|||
throw new Error("hello") |
|||
^ |
|||
Error: hello |
|||
at [eval]:1:7 |
|||
at Object.<anonymous> ([eval]-wrapper:6:22) |
|||
at Module._compile (module.js:449:26) |
|||
at evalScript (node.js:282:25) |
|||
at startup (node.js:76:7) |
|||
at node.js:623:3 |
|||
|
|||
[eval]:1 |
|||
throw new Error("hello") |
|||
^ |
|||
Error: hello |
|||
at [eval]:1:7 |
|||
at Object.<anonymous> ([eval]-wrapper:6:22) |
|||
at Module._compile (module.js:449:26) |
|||
at evalScript (node.js:282:25) |
|||
at startup (node.js:76:7) |
|||
at node.js:623:3 |
|||
100 |
|||
|
|||
[eval]:1 |
|||
var x = 100; y = x; |
|||
^ |
|||
ReferenceError: y is not defined |
|||
at [eval]:1:16 |
|||
at Object.<anonymous> ([eval]-wrapper:6:22) |
|||
at Module._compile (module.js:449:26) |
|||
at evalScript (node.js:282:25) |
|||
at startup (node.js:76:7) |
|||
at node.js:623:3 |
|||
|
|||
[eval]:1 |
|||
var ______________________________________________; throw 10 |
|||
^ |
|||
10 |
|||
|
|||
[eval]:1 |
|||
var ______________________________________________; throw 10 |
|||
^ |
|||
10 |
|||
done |
Loading…
Reference in new issue