Don't tolerate no-selector elements, tolerate Map, adds tests
This commit is contained in:
parent
b1da1af86c
commit
d607326cc7
@ -721,7 +721,7 @@ carto.Parser = function Parser(env) {
|
||||
//
|
||||
element: function() {
|
||||
var e;
|
||||
if (e = $("^(?:(?:[.#][\w-]+|\*|Map))")) {
|
||||
if (e = $(/^(?:[.#][\w-]+|\*|Map)/)) {
|
||||
return new tree.Element(e);
|
||||
}
|
||||
},
|
||||
|
@ -12,12 +12,22 @@ helper.files('errorhandling', 'mml', function(file) {
|
||||
var completed = false;
|
||||
var renderResult;
|
||||
var mml = helper.mml(file);
|
||||
new carto.Renderer({
|
||||
paths: [ path.dirname(file) ],
|
||||
data_dir: path.join(__dirname, '../data'),
|
||||
local_data_dir: path.join(__dirname, 'rendering'),
|
||||
filename: file
|
||||
}).render(mml, function (err) {
|
||||
try {
|
||||
new carto.Renderer({
|
||||
paths: [ path.dirname(file) ],
|
||||
data_dir: path.join(__dirname, '../data'),
|
||||
local_data_dir: path.join(__dirname, 'rendering'),
|
||||
filename: file
|
||||
}).render(mml, function (err) {
|
||||
var result = helper.resultFile(file);
|
||||
var output = err.message;
|
||||
// @TODO for some reason, fs.readFile includes an additional \n
|
||||
// at the end of read files. Determine why.
|
||||
fs.readFile(helper.resultFile(file), 'utf8', function(err, data) {
|
||||
if (!err) assert.deepEqual(output, data.substr(0, data.length - 1));
|
||||
});
|
||||
});
|
||||
} catch(err) {
|
||||
var result = helper.resultFile(file);
|
||||
var output = err.message;
|
||||
// @TODO for some reason, fs.readFile includes an additional \n
|
||||
@ -25,7 +35,8 @@ helper.files('errorhandling', 'mml', function(file) {
|
||||
fs.readFile(helper.resultFile(file), 'utf8', function(err, data) {
|
||||
if (!err) assert.deepEqual(output, data.substr(0, data.length - 1));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
beforeExit(function() {
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user