Commit d4e2d545 d4e2d545104248df5860e9104064af62921848f2 by Nicolas Perriault

migrated require tests to new testing format

1 parent 60c27d7c
......@@ -2,30 +2,36 @@
/*jshint strict:false*/
var fs = require('fs');
var modroot = fs.pathJoin(phantom.casperPath, 'tests', 'sample_modules');
var jsmod, csmod, config;
casper.test.comment('Javascript module loading')
try {
casper.test.begin('Javascript module loading', 1, function(test) {
var jsmod;
try {
jsmod = require(fs.pathJoin(modroot, 'jsmodule'));
casper.test.assertTrue(jsmod.ok, 'require() patched version can load a js module');
} catch (e) {
casper.test.fail('require() patched version can load a js module');
}
test.assertTrue(jsmod.ok, 'require() patched version can load a js module');
} catch (e) {
test.fail('require() patched version can load a js module');
}
test.done();
});
casper.test.comment('CoffeeScript module loading')
try {
casper.test.begin('CoffeeScript module loading', 1, function(test) {
var csmod;
try {
csmod = require(fs.pathJoin(modroot, 'csmodule'));
casper.test.assertTrue(csmod.ok, 'require() patched version can load a coffeescript module');
} catch (e) {
casper.test.fail('require() patched version can load a coffeescript module');
}
test.assertTrue(csmod.ok, 'require() patched version can load a coffeescript module');
} catch (e) {
test.fail('require() patched version can load a coffeescript module');
}
test.done();
});
casper.test.comment('JSON module loading')
try {
casper.test.begin('JSON module loading', 1, function(test) {
var config;
try {
config = require(fs.pathJoin(modroot, 'config.json'));
casper.test.assertTrue(config.ok, 'require() patched version can load a json module');
} catch (e) {
casper.test.fail('require() patched version can load a json module');
}
casper.test.done(3);
test.assertTrue(config.ok, 'require() patched version can load a json module');
} catch (e) {
test.fail('require() patched version can load a json module');
}
test.done();
});
......