Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bin/moshcode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ async function main() {
try { max = parseMax(rest[++k]); }
catch (e) { console.error(String(e.message || e)); process.exit(1); }
}
else if (a.startsWith("--max=")) {
try { max = parseMax(a.slice("--max=".length)); }
catch (e) { console.error(String(e.message || e)); process.exit(1); }
}
else if (a === "--dry-run") dryRun = true;
else if (a.startsWith("-")) {
console.error(`moshcode run: unknown option ${a}`);
Expand Down
7 changes: 7 additions & 0 deletions test/run-options.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ test("run rejects unknown options before treating them as files", () => {
assert.match(result.stderr, /moshcode run: unknown option --dryrun/);
});

test("run accepts equals-form max option", () => {
const result = run(["--max=1", "--dry-run"]);

assert.equal(result.status, 0);
assert.match(result.stdout, /1 loop\(s\)/);
});

test("run rejects multiple script files", () => {
const dir = mkdtempSync(join(tmpdir(), "moshcode-run-"));
const first = join(dir, "first.mosh");
Expand Down
Loading