summaryrefslogtreecommitdiff
path: root/std/flags/stop_early_test.ts
blob: f054d780bc59095785a46b154fa3f8844d3d66d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { test } from "../testing/mod.ts";
import { assertEquals } from "../testing/asserts.ts";
import { parse } from "./mod.ts";

// stops parsing on the first non-option when stopEarly is set
test(function stopParsing(): void {
  const argv = parse(["--aaa", "bbb", "ccc", "--ddd"], {
    stopEarly: true
  });

  assertEquals(argv, {
    aaa: "bbb",
    _: ["ccc", "--ddd"]
  });
});