Browse Source

test-message: fix message output

1. The net changes add a stack frame to stdin errors.
2. The error line numbers were overly strict in many places.
v0.8.7-release
isaacs 13 years ago
parent
commit
93be4ffd4b
  1. 40
      test/message/eval_messages.out
  2. 48
      test/message/stdin_messages.out
  3. 15
      test/message/testcfg.py

40
test/message/eval_messages.out

@ -4,11 +4,11 @@
with(this){__filename} with(this){__filename}
^^^^ ^^^^
SyntaxError: Strict mode code may not include a with statement SyntaxError: Strict mode code may not include a with statement
at Object.<anonymous> ([eval]-wrapper:6:22) at Object.<anonymous> ([eval]-wrapper:*:*)
at Module._compile (module.js:449:26) at Module._compile (module.js:*:*)
at evalScript (node.js:282:25) at evalScript (node.js:*:*)
at startup (node.js:76:7) at startup (node.js:*:*)
at node.js:623:3 at node.js:*:*
42 42
42 42
@ -17,22 +17,22 @@ throw new Error("hello")
^ ^
Error: hello Error: hello
at [eval]:1:7 at [eval]:1:7
at Object.<anonymous> ([eval]-wrapper:6:22) at Object.<anonymous> ([eval]-wrapper:*:*)
at Module._compile (module.js:449:26) at Module._compile (module.js:*:*)
at evalScript (node.js:282:25) at evalScript (node.js:*:*)
at startup (node.js:76:7) at startup (node.js:*:*)
at node.js:623:3 at node.js:*:*
[eval]:1 [eval]:1
throw new Error("hello") throw new Error("hello")
^ ^
Error: hello Error: hello
at [eval]:1:7 at [eval]:1:7
at Object.<anonymous> ([eval]-wrapper:6:22) at Object.<anonymous> ([eval]-wrapper:*:*)
at Module._compile (module.js:449:26) at Module._compile (module.js:*:*)
at evalScript (node.js:282:25) at evalScript (node.js:*:*)
at startup (node.js:76:7) at startup (node.js:*:*)
at node.js:623:3 at node.js:*:*
100 100
[eval]:1 [eval]:1
@ -40,11 +40,11 @@ var x = 100; y = x;
^ ^
ReferenceError: y is not defined ReferenceError: y is not defined
at [eval]:1:16 at [eval]:1:16
at Object.<anonymous> ([eval]-wrapper:6:22) at Object.<anonymous> ([eval]-wrapper:*:*)
at Module._compile (module.js:449:26) at Module._compile (module.js:*:*)
at evalScript (node.js:282:25) at evalScript (node.js:*:*)
at startup (node.js:76:7) at startup (node.js:*:*)
at node.js:623:3 at node.js:*:*
[eval]:1 [eval]:1
var ______________________________________________; throw 10 var ______________________________________________; throw 10

48
test/message/stdin_messages.out

@ -4,12 +4,12 @@
with(this){__filename} with(this){__filename}
^^^^ ^^^^
SyntaxError: Strict mode code may not include a with statement SyntaxError: Strict mode code may not include a with statement
at Object.<anonymous> ([stdin]-wrapper:6:22) at Object.<anonymous> ([stdin]-wrapper:*:*)
at Module._compile (module.js:449:26) at Module._compile (module.js:*:*)
at evalScript (node.js:282:25) at evalScript (node.js:*:*)
at Socket.<anonymous> (node.js:152:11) at Socket.<anonymous> (node.js:*:*)
at Socket.EventEmitter.emit (events.js:85:17) at Socket.EventEmitter.emit (events.js:*:*)
at Pipe.onread (net.js:424:51) at Pipe.onread (net.js:*:*)
42 42
42 42
@ -18,24 +18,24 @@ throw new Error("hello")
^ ^
Error: hello Error: hello
at [stdin]:1:7 at [stdin]:1:7
at Object.<anonymous> ([stdin]-wrapper:6:22) at Object.<anonymous> ([stdin]-wrapper:*:*)
at Module._compile (module.js:449:26) at Module._compile (module.js:*:*)
at evalScript (node.js:282:25) at evalScript (node.js:*:*)
at Socket.<anonymous> (node.js:152:11) at Socket.<anonymous> (node.js:*:*)
at Socket.EventEmitter.emit (events.js:85:17) at Socket.EventEmitter.emit (events.js:*:*)
at Pipe.onread (net.js:424:51) at Pipe.onread (net.js:*:*)
[stdin]:1 [stdin]:1
throw new Error("hello") throw new Error("hello")
^ ^
Error: hello Error: hello
at [stdin]:1:7 at [stdin]:1:7
at Object.<anonymous> ([stdin]-wrapper:6:22) at Object.<anonymous> ([stdin]-wrapper:*:*)
at Module._compile (module.js:449:26) at Module._compile (module.js:*:*)
at evalScript (node.js:282:25) at evalScript (node.js:*:*)
at Socket.<anonymous> (node.js:152:11) at Socket.<anonymous> (node.js:*:*)
at Socket.EventEmitter.emit (events.js:85:17) at Socket.EventEmitter.emit (events.js:*:*)
at Pipe.onread (net.js:424:51) at Pipe.onread (net.js:*:*)
100 100
[stdin]:1 [stdin]:1
@ -43,12 +43,12 @@ var x = 100; y = x;
^ ^
ReferenceError: y is not defined ReferenceError: y is not defined
at [stdin]:1:16 at [stdin]:1:16
at Object.<anonymous> ([stdin]-wrapper:6:22) at Object.<anonymous> ([stdin]-wrapper:*:*)
at Module._compile (module.js:449:26) at Module._compile (module.js:*:*)
at evalScript (node.js:282:25) at evalScript (node.js:*:*)
at Socket.<anonymous> (node.js:152:11) at Socket.<anonymous> (node.js:*:*)
at Socket.EventEmitter.emit (events.js:85:17) at Socket.EventEmitter.emit (events.js:*:*)
at Pipe.onread (net.js:424:51) at Pipe.onread (net.js:*:*)
[stdin]:1 [stdin]:1
var ______________________________________________; throw 10 var ______________________________________________; throw 10

15
test/message/testcfg.py

@ -43,7 +43,7 @@ class MessageTestCase(test.TestCase):
def IgnoreLine(self, str): def IgnoreLine(self, str):
"""Ignore empty lines and valgrind output.""" """Ignore empty lines and valgrind output."""
if not str: return True if not str.strip(): return True
else: return str.startswith('==') or str.startswith('**') else: return str.startswith('==') or str.startswith('**')
def IsFailureOutput(self, output): def IsFailureOutput(self, output):
@ -66,9 +66,22 @@ class MessageTestCase(test.TestCase):
raw_lines = (output.stdout + output.stderr).split('\n') raw_lines = (output.stdout + output.stderr).split('\n')
outlines = [ s for s in raw_lines if not self.IgnoreLine(s) ] outlines = [ s for s in raw_lines if not self.IgnoreLine(s) ]
if len(outlines) != len(patterns): if len(outlines) != len(patterns):
print "length differs."
print "expect=%d" % len(patterns)
print "actual=%d" % len(outlines)
print "patterns:"
for i in xrange(len(patterns)):
print "pattern = %s" % patterns[i]
print "outlines:"
for i in xrange(len(outlines)):
print "outline = %s" % outlines[i]
return True return True
for i in xrange(len(patterns)): for i in xrange(len(patterns)):
if not re.match(patterns[i], outlines[i]): if not re.match(patterns[i], outlines[i]):
print "match failed"
print "line=%d" % i
print "expect=%s" % patterns[i]
print "actual=%s" % outlines[i]
return True return True
return False return False

Loading…
Cancel
Save