summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Pastore <mike@oobak.org>2016-02-17 18:04:00 -0600
committerMike Pastore <mike@oobak.org>2016-02-18 02:54:05 -0600
commit082e69de977ac58d0981e807a1cb33a1ed2958c3 (patch)
tree0df093b014357756788bb8a1ca7117024c23cc6c /test
parent2a66aadabc37b512d449aaf45d34cb3b2e0cfc7a (diff)
downloadslop-082e69de977ac58d0981e807a1cb33a1ed2958c3.tar.gz
Allow disabling the delimiter for array arguments
Diffstat (limited to 'test')
-rw-r--r--test/types_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/types_test.rb b/test/types_test.rb
index f806c48..43c356e 100644
--- a/test/types_test.rb
+++ b/test/types_test.rb
@@ -67,6 +67,7 @@ describe Slop::ArrayOption do
before do
@options = Slop::Options.new
@files = @options.array "--files"
+ @multi = @options.array "-M", delimiter: nil
@delim = @options.array "-d", delimiter: ":"
@limit = @options.array "-l", limit: 2
@result = @options.parse %w(--files foo.txt,bar.rb)
@@ -85,6 +86,11 @@ describe Slop::ArrayOption do
assert_equal %w(foo.txt bar.rb), @result[:files]
end
+ it "collects multiple option values with no delimiter" do
+ @result.parser.parse %w(-M foo,bar -M bar,qux)
+ assert_equal %w(foo,bar bar,qux), @result[:M]
+ end
+
it "can use a custom delimiter" do
@result.parser.parse %w(-d foo.txt:bar.rb)
assert_equal %w(foo.txt bar.rb), @result[:d]