Skip to content

Commit

Permalink
Merge pull request #318 from wilzbach/partially-revert-303
Browse files Browse the repository at this point in the history
Partially revert #303 until #317 is resolved
merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
  • Loading branch information
dlang-bot committed Feb 13, 2018
2 parents 8df8eb7 + 6a1b3fb commit 5cc9864
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions rdmd.d
Expand Up @@ -831,23 +831,26 @@ string innerEvalCode(string[] eval)
import std.string : join, stripRight;
// assumeSafeAppend just to avoid unnecessary reallocation
string code = eval.join("\n").stripRight.assumeSafeAppend;
if (code.length > 0 && code[$ - 1] != ';')
code ~= ';';
// 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 ~= ';';
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!\");");
}
Expand Down Expand Up @@ -891,10 +894,11 @@ 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
assert(makeEvalCode([`writeln("Hello!") `], No.loop) ==
importWorld
~ "void main(char[][] args) {\n"
~ "writeln(\"Hello!\");\n}");
// 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("What!"); `], No.loop) ==
importWorld
Expand Down

0 comments on commit 5cc9864

Please sign in to comment.