From 4710be2fb3a6f76c06a118f6d41e3c289c3f8324 Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Thu, 14 Jan 2021 20:45:26 -0500 Subject: [PATCH] parser: add some more tests --- Library/Homebrew/test/cli/parser_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Library/Homebrew/test/cli/parser_spec.rb b/Library/Homebrew/test/cli/parser_spec.rb index 0a4ca16436..6c99d1bb3d 100644 --- a/Library/Homebrew/test/cli/parser_spec.rb +++ b/Library/Homebrew/test/cli/parser_spec.rb @@ -397,6 +397,13 @@ describe Homebrew::CLI::Parser do expect { parser.parse([]) }.to raise_error(Homebrew::CLI::MinNamedArgumentsError) end + it "treats a symbol as a single argument of the specified type" do + formula_parser = described_class.new do + named :formula + end + expect { formula_parser.parse([]) }.to raise_error(UsageError, /this command requires a formula argument/) + end + it "doesn't allow more than the specified number of arguments" do expect { parser.parse(["foo", "bar"]) }.to raise_error(Homebrew::CLI::MaxNamedArgumentsError) end