summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/error_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/error_test.rb b/test/error_test.rb
index 4528623..6a33c04 100644
--- a/test/error_test.rb
+++ b/test/error_test.rb
@@ -15,3 +15,17 @@ describe Slop::MissingArgument do
opts.parse %w(--name)
end
end
+
+describe Slop::UnknownOption do
+ it "raises when an option is unknown" do
+ opts = Slop::Options.new
+ opts.string "-n", "--name"
+ assert_raises(Slop::UnknownOption) { opts.parse %w(--foo) }
+ end
+
+ it "does not raise when errors are suppressed" do
+ opts = Slop::Options.new(suppress_errors: true)
+ opts.string "-n", "--name"
+ opts.parse %w(--foo)
+ end
+end