summaryrefslogtreecommitdiff
path: root/test/types_test.rb
diff options
context:
space:
mode:
authorLee Jarvis <leejarvis@fastmail.com>2019-09-09 11:57:11 +0100
committerGitHub <noreply@github.com>2019-09-09 11:57:11 +0100
commit494c184de62242e0bdb5c2f879647628bae32e3f (patch)
tree74221993bfd0ca0745c657b743be870df672ace5 /test/types_test.rb
parent4e60891d9bed6d08b8ab46634b0239f11f2ca4bf (diff)
parent4289f4c62d546ea5af8b3a526e4606d7ed01e64c (diff)
downloadslop-494c184de62242e0bdb5c2f879647628bae32e3f.tar.gz
Merge pull request #243 from jylitalo/plus_prefix
Support '+' as prefix for integer
Diffstat (limited to 'test/types_test.rb')
-rw-r--r--test/types_test.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/types_test.rb b/test/types_test.rb
index c1aabaa..f6b928e 100644
--- a/test/types_test.rb
+++ b/test/types_test.rb
@@ -32,11 +32,15 @@ describe Slop::IntegerOption do
before do
@options = Slop::Options.new
@age = @options.integer "--age"
- @result = @options.parse %w(--age 20)
+ @minus = @options.integer "--minus"
+ @plus = @options.integer "--plus"
+ @result = @options.parse %w(--age 20 --minus -10 --plus +30)
end
it "returns the value as an integer" do
assert_equal 20, @result[:age]
+ assert_equal -10, @result[:minus]
+ assert_equal 30, @result[:plus]
end
it "returns nil for non-numbers by default" do