2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2012-02-26 21:26:09 +09:00
|
|
|
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) {
|
2015-07-06 03:24:12 +00:00
|
|
|
console.log('1..0 # Skipped: platform not supported.');
|
2015-07-07 20:55:55 +05:30
|
|
|
return;
|
2012-02-26 21:26:09 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
require('../fixtures/module-loading-error.node');
|
|
|
|
} catch (e) {
|
|
|
|
assert.notEqual(e.toString().indexOf(dlerror_msg), -1);
|
|
|
|
}
|
2014-09-09 10:22:37 +08:00
|
|
|
|
|
|
|
try {
|
|
|
|
require();
|
|
|
|
} catch (e) {
|
|
|
|
assert.notEqual(e.toString().indexOf('missing path'), -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
require({});
|
|
|
|
} catch (e) {
|
|
|
|
assert.notEqual(e.toString().indexOf('path must be a string'), -1);
|
|
|
|
}
|