From 10ea76770889edba8a11a427606a563f447208ce Mon Sep 17 00:00:00 2001 From: Luke Page Date: Sun, 4 Jan 2015 08:45:31 +0000 Subject: [PATCH] Fix #2242 - detect if less does not parse final character --- lib/less/parser/parser-input.js | 2 +- test/less/errors/single-character.less | 1 + test/less/errors/single-character.txt | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 test/less/errors/single-character.less create mode 100644 test/less/errors/single-character.txt diff --git a/lib/less/parser/parser-input.js b/lib/less/parser/parser-input.js index 267ef8ea..ad799e85 100644 --- a/lib/less/parser/parser-input.js +++ b/lib/less/parser/parser-input.js @@ -239,7 +239,7 @@ module.exports = function() { parserInput.end = function() { var message, - isFinished = parserInput.i >= input.length - 1; + isFinished = parserInput.i >= input.length; if (parserInput.i < furthest) { message = furthestPossibleErrorMessage; diff --git a/test/less/errors/single-character.less b/test/less/errors/single-character.less new file mode 100644 index 00000000..c1b0730e --- /dev/null +++ b/test/less/errors/single-character.less @@ -0,0 +1 @@ +x \ No newline at end of file diff --git a/test/less/errors/single-character.txt b/test/less/errors/single-character.txt new file mode 100644 index 00000000..b9e49a5e --- /dev/null +++ b/test/less/errors/single-character.txt @@ -0,0 +1,2 @@ +ParseError: Unrecognised input. Possibly missing something in {path}single-character.less on line 1, column 2: +1 x