diff --git a/hscript/Parser.hx b/hscript/Parser.hx index 935ce78..0099e88 100644 --- a/hscript/Parser.hx +++ b/hscript/Parser.hx @@ -2006,11 +2006,9 @@ class Parser { if(valid) { if(interpString == null) interpString = []; - if(interpString.length > 0) { // store the current string - if(b.length > 0) - interpString.push(getTokenList(TConst(CString(b.toString())))); - b = new StringBuf(); - } + if(b.length > 0) // store the current string + interpString.push(getTokenList(TConst(CString(b.toString())))); + b = new StringBuf(); interpolation = true; } else { b.addChar(c); diff --git a/tests/src/Util.hx b/tests/src/Util.hx index 3be93d1..a19833b 100644 --- a/tests/src/Util.hx +++ b/tests/src/Util.hx @@ -15,6 +15,10 @@ class Util { return false; } + if ((a is String) && (b is String)) { + return a == b; + } + if ((a is Array) && (b is Array)) { var aArray:Array = cast a; var bArray:Array = cast b; diff --git a/tests/src/tests/StringCase.hx b/tests/src/tests/StringCase.hx index bb84fcb..f9c4d58 100644 --- a/tests/src/tests/StringCase.hx +++ b/tests/src/tests/StringCase.hx @@ -150,6 +150,9 @@ class StringCase extends TestCase { assertEq("'$a+5 Hello ${a+5}'", '$a+5 Hello ${a+5}'); //assertEq("'$a+5 Hello ${a+5}'", "" + a + "+5 Hello " + a + 5); headerCode = ''; + + assertEq("'hello ${5} world'", 'hello ${5} world'); + assertEq("'hello ${5}'", 'hello ${5}'); } override function teardown() {