mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
Allow creating parser without options. Fixes #1373
This commit is contained in:
@@ -30,13 +30,15 @@
|
||||
if (!this.files) { this.files = {}; }
|
||||
|
||||
if (!this.currentFileInfo) {
|
||||
var filename = options.filename || "input";
|
||||
options.filename = null;
|
||||
var filename = (options && options.filename) || "input";
|
||||
var entryPath = filename.replace(/[^\/\\]*$/, "");
|
||||
if (options) {
|
||||
options.filename = null;
|
||||
}
|
||||
this.currentFileInfo = {
|
||||
filename: filename,
|
||||
relativeUrls: this.relativeUrls,
|
||||
rootpath: options.rootpath || "",
|
||||
rootpath: (options && options.rootpath) || "",
|
||||
currentDirectory: entryPath,
|
||||
entryPath: entryPath,
|
||||
rootFilename: filename
|
||||
|
||||
@@ -62,6 +62,7 @@ runTestSet({strictMath: true, dumpLineNumbers: 'all'}, "debug/", null,
|
||||
runTestSet({strictMath: true, relativeUrls: false, rootpath: "folder (1)/"}, "static-urls/");
|
||||
runTestSet({strictMath: true, compress: true}, "compression/");
|
||||
runTestSet({strictMath: false}, "legacy/");
|
||||
testNoOptions();
|
||||
|
||||
function globalReplacements(input, directory) {
|
||||
var p = path.join(process.cwd(), directory),
|
||||
@@ -184,3 +185,15 @@ function toCSS(options, path, callback) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testNoOptions() {
|
||||
totalTests++;
|
||||
try {
|
||||
sys.print("- Integration - creating parser without options: ");
|
||||
new(less.Parser);
|
||||
} catch(e) {
|
||||
fail(stylize("FAIL\n", "red"));
|
||||
return;
|
||||
}
|
||||
ok(stylize("OK\n", "green"));
|
||||
}
|
||||
Reference in New Issue
Block a user