Skip to content

Commit

Permalink
Merge pull request dlang#408 from Geod24/fix13345
Browse files Browse the repository at this point in the history
Fix issue 13345 - Add argument support to rdmd --eval
merged-on-behalf-of: Nicholas Wilson <[email protected]>
  • Loading branch information
dlang-bot authored Jun 5, 2020
2 parents a0d27c1 + 5e0317a commit ab39874
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
3 changes: 1 addition & 2 deletions rdmd.d
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,9 @@ int main(string[] args)
}
else if (eval.ptr)
{
enforce(programPos == args.length, "Cannot have both --eval and a " ~
"program file ('" ~ args[programPos] ~ "').");
root = makeEvalFile(makeEvalCode(eval, No.loop));
argsBeforeProgram ~= "-d";
programArgs = args[programPos .. $];
}
else if (programPos < args.length)
{
Expand Down
11 changes: 4 additions & 7 deletions rdmd_test.d
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module rdmd_test;
import std.algorithm;
import std.exception;
import std.file;
import std.format;
import std.getopt;
import std.path;
import std.process;
Expand Down Expand Up @@ -250,12 +251,10 @@ void runTests(string rdmdApp, string compiler, string model)
"--eval=debug {} else assert(false);"]);
enforce(res.status == 0, res.output);

// vs program file
// When using eval, extra arguments are program arguments
res = execute(rdmdArgs ~ ["--force",
"--eval=assert(true);", voidMain]);
enforce(res.status != 0);
enforce(res.output.canFind("Cannot have both --eval and a program file ('" ~
voidMain ~ "')."));
format("--eval=assert(args[1] == `%s`);", voidMain), voidMain]);
enforce(res.status == 0, res.output);

/* Test --exclude. */
string packFolder = tempDir().buildPath("dsubpack");
Expand Down Expand Up @@ -627,8 +626,6 @@ void runTests(string rdmdApp, string compiler, string model)
stderr.writefln("rdmd_test: Make version (%s) is too old, skipping Make SHELL/SHELLFLAGS test", makeVersion);
else
{
import std.format : format;

auto textOutput = tempDir().buildPath("rdmd_makefile_test.txt");
if (exists(textOutput))
{
Expand Down

0 comments on commit ab39874

Please sign in to comment.