summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLee Jarvis <ljjarvis@gmail.com>2014-12-30 15:04:26 +0000
committerLee Jarvis <ljjarvis@gmail.com>2014-12-30 15:04:26 +0000
commitd6b91418f9cb8aa141ecb1f4c00c5f06ae293b67 (patch)
tree7fb8f91ce5bfde32772b21a8f1e82411ad5175ef /test
parent2ae81e5ced1bd5af3cd891a04e1750a6019e114b (diff)
downloadslop-d6b91418f9cb8aa141ecb1f4c00c5f06ae293b67.tar.gz
Support a limit config to ArrayOption
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 e060df5..1716776 100644
--- a/test/types_test.rb
+++ b/test/types_test.rb
@@ -57,6 +57,7 @@ describe Slop::ArrayOption do
@options = Slop::Options.new
@files = @options.array "--files"
@delim = @options.array "-d", delimiter: ":"
+ @limit = @options.array "-l", limit: 2
@result = @options.parse %w(--files foo.txt,bar.rb)
end
@@ -77,6 +78,11 @@ describe Slop::ArrayOption do
@result.parser.reset.parse %w(-d foo.txt:bar.rb)
assert_equal %w(foo.txt bar.rb), @result[:d]
end
+
+ it "can use a custom limit" do
+ @result.parser.reset.parse %w(-l foo,bar,baz)
+ assert_equal ["foo", "bar,baz"], @result[:l]
+ end
end
describe Slop::NullOption do