Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

test for spotted bug #165

Merged
merged 5 commits into from
Dec 20, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/swig.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ exports.compileFile = function (filepath, forceAllowErrors) {
}
if (_config.root instanceof Array) {
c = 0;
while (tpl === undefined || c < _config.root.length) {
while (tpl === undefined && c < _config.root.length) {
getSingle(_config.root[c]);
c = c + 1;
}
Expand Down
8 changes: 8 additions & 0 deletions tests/node/swig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ describe('swig.compileFile', function () {
expect(swig.compileFile('included_2.html').render({ array: [1, 1] }))
.to.equal('2');
});
it('accepts an array in root config and does not hangs on missing file', function () {
swig.init({
root: ["/", __dirname + '/templates'],
allowErrors: true
});
expect(function () { swig.compileFile('notexistingFile.html').render({ array: [1, 1] }); })
.to.throwException();
});
it('can use an absolute path', function () {
swig.init({
root: __dirname + '/templates',
Expand Down