Parser fully finished and functional, posix compliant and tested - all green
This commit is contained in:
@@ -43,6 +43,22 @@ describe("parseCommand", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("returns a parsed grep command with a valued color in short form and r flags", () => {
|
||||
expect(parseCommand("grep -color=auto -r")).toEqual({
|
||||
command: "grep",
|
||||
flags: ["color=auto", "r"],
|
||||
args: [],
|
||||
});
|
||||
});
|
||||
|
||||
test("returns a parsed grep command with a valued w in short form and r flags", () => {
|
||||
expect(parseCommand("grep -w=auto -r")).toEqual({
|
||||
command: "grep",
|
||||
flags: ["w=auto", "r"],
|
||||
args: [],
|
||||
});
|
||||
});
|
||||
|
||||
test("returns a parsed echo command with a --version arg", () => {
|
||||
expect(parseCommand("echo -- --version")).toEqual({ command: "echo", flags: [], args: ["--version"] });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user