Skip to content

Commit

Permalink
verify that narcissus js errors are parsed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
fjakobs committed Aug 17, 2011
1 parent 35f6d37 commit 9e84157
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/ace/mode/javascript_worker.js
Expand Up @@ -25,10 +25,13 @@ oop.inherits(JavaScriptWorker, Mirror);
} catch(e) {
// console.log("narcissus")
// console.log(e);
var chunks = e.message.split(":")
var message = chunks.pop().trim();
var lineNumber = parseInt(chunks.pop().trim()) - 1;
this.sender.emit("narcissus", {
row: e.lineno-1,
row: lineNumber,
column: null, // TODO convert e.cursor
text: e.message,
text: message,
type: "error"
});
return;
Expand Down
7 changes: 6 additions & 1 deletion lib/ace/mode/javascript_worker_test.js
Expand Up @@ -63,7 +63,12 @@ module.exports = {
var worker = new JavaScriptWorker(this.sender);
worker.setValue("Juhu Kinners");
worker.deferredUpdate.call();
assert.equal(this.sender.events[0][1].type, "error");

var error = this.sender.events[0][1];
assert.equal(error.text, "missing ; before statement");
assert.equal(error.type, "error");
assert.equal(error.row, 0);
assert.equal(error.column, null);
},

"test check for narcissus bug": function() {
Expand Down

0 comments on commit 9e84157

Please sign in to comment.