throw proper ConfigException if EOF occurs before a ${} token ends

It was throwing because -1 was passed to a %c format string
This commit is contained in:
Havoc Pennington 2011-12-09 10:12:01 -05:00
parent 694dd9bef5
commit aa8a258b59
2 changed files with 5 additions and 1 deletions

View File

@ -36,6 +36,8 @@ final class Tokenizer {
return "newline";
else if (codepoint == '\t')
return "tab";
else if (codepoint == -1)
return "end of file";
else if (Character.isISOControl(codepoint))
return String.format("control character 0x%x", codepoint);
else

View File

@ -167,7 +167,9 @@ class TokenizerTest extends TestUtils {
"\"\\u\"", // too short
"\"", // just a single quote
""" "abcdefg""", // no end quote
"""\"\""" // file ends with a backslash
"""\"\""", // file ends with a backslash
"$", // file ends with a $
"${" // file ends with a ${
)
for (t <- invalidTests) {