summaryrefslogtreecommitdiff
path: root/test/slop_test.rb
diff options
context:
space:
mode:
authorLee Jarvis <lee@jarvis.co>2012-01-30 11:28:45 +0000
committerLee Jarvis <lee@jarvis.co>2012-01-30 11:28:45 +0000
commit2e4529aa32c89ffbfb780ce39b0b41c3838de0a8 (patch)
treefba35b6c18e46d5e6fda36be55e691b0a0f4907c /test/slop_test.rb
parent60c2a9246155206d4d5ddca750a51859ca8ad42a (diff)
downloadslop-2e4529aa32c89ffbfb780ce39b0b41c3838de0a8.tar.gz
fix option terminator parsing
Diffstat (limited to 'test/slop_test.rb')
-rw-r--r--test/slop_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/slop_test.rb b/test/slop_test.rb
index c557891..82aaad4 100644
--- a/test/slop_test.rb
+++ b/test/slop_test.rb
@@ -177,6 +177,13 @@ class SlopTest < TestCase
refute opts.fetch_option(:baz).expects_argument?
end
+ test "option terminator" do
+ opts = Slop.new { on :foo= }
+ items = %w' foo -- --foo bar '
+ opts.parse! items
+ assert_equal %w' foo --foo bar ', items
+ end
+
test "raising an InvalidArgumentError when the argument doesn't match" do
opts = Slop.new { on :foo=, :match => /^[a-z]+$/ }
assert_raises(Slop::InvalidArgumentError) { opts.parse %w' --foo b4r '}