mirror of https://github.com/lukechilds/node.git
isaacs
13 years ago
2 changed files with 116 additions and 0 deletions
@ -0,0 +1,54 @@ |
|||
|
|||
// 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('-p'); |
|||
var child = spawn(process.execPath, args); |
|||
child.stdout.pipe(process.stdout); |
|||
child.stderr.pipe(process.stdout); |
|||
child.stdin.end(cmd); |
|||
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,62 @@ |
|||
[stdin] |
|||
|
|||
[stdin]:1 |
|||
with(this){__filename} |
|||
^^^^ |
|||
SyntaxError: Strict mode code may not include a with statement |
|||
at Object.<anonymous> ([stdin]-wrapper:6:22) |
|||
at Module._compile (module.js:449:26) |
|||
at evalScript (node.js:282:25) |
|||
at Socket.<anonymous> (node.js:152:11) |
|||
at Socket.EventEmitter.emit (events.js:85:17) |
|||
at Pipe.onread (net.js:424:51) |
|||
42 |
|||
42 |
|||
|
|||
[stdin]:1 |
|||
throw new Error("hello") |
|||
^ |
|||
Error: hello |
|||
at [stdin]:1:7 |
|||
at Object.<anonymous> ([stdin]-wrapper:6:22) |
|||
at Module._compile (module.js:449:26) |
|||
at evalScript (node.js:282:25) |
|||
at Socket.<anonymous> (node.js:152:11) |
|||
at Socket.EventEmitter.emit (events.js:85:17) |
|||
at Pipe.onread (net.js:424:51) |
|||
|
|||
[stdin]:1 |
|||
throw new Error("hello") |
|||
^ |
|||
Error: hello |
|||
at [stdin]:1:7 |
|||
at Object.<anonymous> ([stdin]-wrapper:6:22) |
|||
at Module._compile (module.js:449:26) |
|||
at evalScript (node.js:282:25) |
|||
at Socket.<anonymous> (node.js:152:11) |
|||
at Socket.EventEmitter.emit (events.js:85:17) |
|||
at Pipe.onread (net.js:424:51) |
|||
100 |
|||
|
|||
[stdin]:1 |
|||
var x = 100; y = x; |
|||
^ |
|||
ReferenceError: y is not defined |
|||
at [stdin]:1:16 |
|||
at Object.<anonymous> ([stdin]-wrapper:6:22) |
|||
at Module._compile (module.js:449:26) |
|||
at evalScript (node.js:282:25) |
|||
at Socket.<anonymous> (node.js:152:11) |
|||
at Socket.EventEmitter.emit (events.js:85:17) |
|||
at Pipe.onread (net.js:424:51) |
|||
|
|||
[stdin]:1 |
|||
var ______________________________________________; throw 10 |
|||
^ |
|||
10 |
|||
|
|||
[stdin]:1 |
|||
var ______________________________________________; throw 10 |
|||
^ |
|||
10 |
|||
done |
Loading…
Reference in new issue