Added test-util-inspect.js

This commit is contained in:
jfdenise 2014-01-14 12:08:09 +01:00
parent b946c658f4
commit f34a4de20c
3 changed files with 19 additions and 0 deletions

View File

@ -336,6 +336,7 @@
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-string-decoder.js"/>
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-timers-unref.js"/>
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-timers-zero-timeout.js"/>
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-util-inspect.js"/>
<!-- tls tests -->
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-tls-connect-pipe.js"/>
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-tls-fast-writing.js"/>
@ -439,6 +440,7 @@
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-string-decoder.js"/>
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-timers-unref.js"/>
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-timers-zero-timeout.js"/>
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-util-inspect.js"/>
<!-- tls tests -->
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-tls-connect-pipe.js"/>
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-tls-fast-writing.js"/>

View File

@ -0,0 +1,16 @@
--- ../node/test/simple/test-util-inspect.js 2013-12-09 10:27:58.000000000 +0100
+++ ./test/simple/test-util-inspect.js 2014-01-14 12:04:38.000000000 +0100
@@ -71,9 +71,11 @@
try {
undef();
} catch (e) {
- assert.equal(util.inspect(e), '[ReferenceError: undef is not defined]');
+ assert.equal(util.inspect(e), '[ReferenceError: \"undef\" is not defined]');
}
-var ex = util.inspect(new Error('FAIL'), true);
+var error = new Error('FAIL');
+Error.captureStackTrace(error);
+var ex = util.inspect(error, true);
assert.ok(ex.indexOf('[Error: FAIL]') != -1);
assert.ok(ex.indexOf('[stack]') != -1);
assert.ok(ex.indexOf('[message]') != -1);

View File

@ -637,6 +637,7 @@ source.test.simple.list = \
test-url.js \
test-utf8-scripts.js \
test-util-format.js \
test-util-inspect.js \
test-util.js \
test-vm-create-context-accessors.js \
test-vm-create-context-arg.js \