Comparing version 0.4.2 to 0.4.3
@@ -193,2 +193,7 @@ | ||
var js = str.substring(i, end); | ||
var n = 0; | ||
while ((n = js.indexOf("\n", n)) > -1) { | ||
n++; | ||
lineno++; | ||
} | ||
if (js[0] == ':') js = filtered(js); | ||
@@ -195,0 +200,0 @@ buf.push(prefix, js, postfix); |
0.4.3 / 2011-06-20 | ||
================== | ||
* Fixed stacktraces line number when used multiline js expressions [Octave] | ||
0.4.2 / 2011-05-11 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -18,3 +18,3 @@ | ||
exports.version = '0.4.2'; | ||
exports.version = '0.4.3'; | ||
@@ -142,5 +142,8 @@ /** | ||
var start = i; | ||
var end = str.indexOf(close, i); | ||
var js = str.substring(i, end); | ||
var end = str.indexOf(close, i) | ||
, js = str.substring(i, end) | ||
, start = i | ||
, n = 0; | ||
while (~(n = js.indexOf("\n", n))) n++, lineno++; | ||
if (js[0] == ':') js = filtered(js); | ||
@@ -147,0 +150,0 @@ buf.push(prefix, js, postfix); |
{ | ||
"name": "ejs", | ||
"description": "Embedded JavaScript templates", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -6,0 +6,0 @@ "keywords": ["template", "engine", "ejs"], |
@@ -244,3 +244,26 @@ | ||
} | ||
}, | ||
'test useful stack traces multiline': function(assert){ | ||
var str = [ | ||
"A little somethin'", | ||
"somethin'", | ||
"<% var some = 'pretty';", | ||
" var multiline = 'javascript';", | ||
"%>", | ||
"<% if (name) { %>", // Failing line | ||
" <p><%= name %></p>", | ||
" <p><%= email %></p>", | ||
"<% } %>" | ||
].join("\n"); | ||
try { | ||
ejs.render(str) | ||
} catch( err ){ | ||
assert.includes(err.message,"name is not defined"); | ||
assert.eql(err.name,"ReferenceError"); | ||
var lineno = parseInt(err.toString().match(/ejs:(\d+)\n/)[1]); | ||
assert.eql(lineno,6,"Error should been thrown on line 3, was thrown on line "+lineno); | ||
} | ||
} | ||
}; |
157825
1385