summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorShigeki Ohtsu <ohtsu@iij.ad.jp>2012-02-26 21:26:09 +0900
committerBen Noordhuis <info@bnoordhuis.nl>2012-03-06 01:34:39 +0100
commit59c3923672d33b4936fc9f82099be522b27f398e (patch)
tree851decacb65ceabefd302b9ab6d99e5b5212b244 /test
parent39ce94276ae31be733d9e6de61764d0485322374 (diff)
downloadnode-new-59c3923672d33b4936fc9f82099be522b27f398e.tar.gz
process: show detailed error message in process.dlopen()
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/module-loading-error.node1
-rw-r--r--test/simple/test-module-loading-error.js44
2 files changed, 45 insertions, 0 deletions
diff --git a/test/fixtures/module-loading-error.node b/test/fixtures/module-loading-error.node
new file mode 100644
index 0000000000..323fae03f4
--- /dev/null
+++ b/test/fixtures/module-loading-error.node
@@ -0,0 +1 @@
+foobar
diff --git a/test/simple/test-module-loading-error.js b/test/simple/test-module-loading-error.js
new file mode 100644
index 0000000000..c1afd58e07
--- /dev/null
+++ b/test/simple/test-module-loading-error.js
@@ -0,0 +1,44 @@
+// 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');
+
+common.debug('load test-module-loading-error.js');
+
+var error_desc = {
+ win32: '%1 is not a valid Win32 application',
+ linux: 'file too short',
+ sunos: 'unknown file type'
+};
+
+var dlerror_msg = error_desc[process.platform];
+
+if (!dlerror_msg) {
+ console.error('Skipping test, platform not supported.');
+ process.exit();
+}
+
+try {
+ require('../fixtures/module-loading-error.node');
+} catch (e) {
+ assert.notEqual(e.toString().indexOf(dlerror_msg), -1);
+}