From 40ef4335a0e54b0c474af4fa690fe332c4617c1c Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Tue, 13 Feb 2018 20:55:42 +0100 Subject: [PATCH] Revert "Partially revert #303 until #317 is resolved" --- rdmd.d | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/rdmd.d b/rdmd.d index 6f76acdb80..4ca39b380f 100755 --- a/rdmd.d +++ b/rdmd.d @@ -831,26 +831,23 @@ string innerEvalCode(string[] eval) import std.string : join, stripRight; // assumeSafeAppend just to avoid unnecessary reallocation string code = eval.join("\n").stripRight.assumeSafeAppend; - // Revert https://github.com/dlang/tools/pull/303 until - // https://github.com/dlang/tools/pull/317 has been resolved - //if (code.length > 0 && code[$ - 1] != ';') - //code ~= ';'; + if (code.length > 0 && code[$ - 1] != ';') + code ~= ';'; return code; } -// partially reverted until https://github.com/dlang/tools/pull/317 is resolved unittest { - //assert(innerEvalCode([`writeln("Hello!")`]) == `writeln("Hello!");`); + assert(innerEvalCode([`writeln("Hello!")`]) == `writeln("Hello!");`); assert(innerEvalCode([`writeln("Hello!");`]) == `writeln("Hello!");`); // test with trailing whitespace - //assert(innerEvalCode([`writeln("Hello!") `]) == `writeln("Hello!");`); + assert(innerEvalCode([`writeln("Hello!") `]) == `writeln("Hello!");`); assert(innerEvalCode([`writeln("Hello!"); `]) == `writeln("Hello!");`); // test with multiple entries - //assert(innerEvalCode([`writeln("Hello!"); `, `writeln("You!") `]) - //== "writeln(\"Hello!\"); \nwriteln(\"You!\");"); + assert(innerEvalCode([`writeln("Hello!"); `, `writeln("You!") `]) + == "writeln(\"Hello!\"); \nwriteln(\"You!\");"); assert(innerEvalCode([`writeln("Hello!"); `, `writeln("You!"); `]) == "writeln(\"Hello!\"); \nwriteln(\"You!\");"); } @@ -894,11 +891,10 @@ unittest // innerEvalCode already tests the cases for different // contents in `eval` array, so let's focus on testing // the difference based on the `loop` flag - // partially reverted until https://github.com/dlang/tools/pull/317 is resolved - //assert(makeEvalCode([`writeln("Hello!") `], No.loop) == - //importWorld - //~ "void main(char[][] args) {\n" - //~ "writeln(\"Hello!\");\n}"); + assert(makeEvalCode([`writeln("Hello!") `], No.loop) == + importWorld + ~ "void main(char[][] args) {\n" + ~ "writeln(\"Hello!\");\n}"); assert(makeEvalCode([`writeln("What!"); `], No.loop) == importWorld