summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Jarvis <leejarvis@fastmail.com>2020-01-28 14:17:41 +0000
committerLee Jarvis <leejarvis@fastmail.com>2020-01-28 14:17:41 +0000
commit0a44dfe8594e5a3fc86d557ab8140434900990d2 (patch)
treea0b72d16b92dd6ae41ef9144f5eb7683b8716825
parentc5e0af0f54ccd3f57b84c8076c455be1905aa1bf (diff)
downloadslop-0a44dfe8594e5a3fc86d557ab8140434900990d2.tar.gz
Add basic test for Slop.parse
See https://github.com/leejarvis/slop/pull/251
-rw-r--r--test/slop_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/slop_test.rb b/test/slop_test.rb
index 2610ebd..35c4b8e 100644
--- a/test/slop_test.rb
+++ b/test/slop_test.rb
@@ -1,6 +1,16 @@
require "test_helper"
describe Slop do
+ describe ".parse" do
+ it "parses a list of arguments" do
+ result = Slop.parse(%w[--name Lee]) do |o|
+ o.string "--name"
+ end
+
+ assert_equal "Lee", result[:name]
+ end
+ end
+
describe ".option_defined?" do
it "handles bad constant names" do
assert_equal false, Slop.option_defined?("Foo?Bar")