Don't tolerate no-selector elements, tolerate Map, adds tests

This commit is contained in:
Tom MacWright 2011-10-13 11:12:50 -04:00
parent b1da1af86c
commit d607326cc7
2 changed files with 19 additions and 8 deletions

View File

@ -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);
}
},

View File

@ -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() {
/*