diff options
author | Lee Jarvis <lee@jarvis.co> | 2012-01-23 14:19:44 +0000 |
---|---|---|
committer | Lee Jarvis <lee@jarvis.co> | 2012-01-23 14:19:44 +0000 |
commit | 44cd850b6f8cce244b9f55537196baf0dc9c2f7a (patch) | |
tree | 07278a9e90bb78f1c378abbe9904b8d7301d603b /test/option_test.rb | |
parent | eecbddbb12c65eb672bf14f2510a73e1aae37d5b (diff) | |
download | slop-44cd850b6f8cce244b9f55537196baf0dc9c2f7a.tar.gz |
value_to_range return a range even if the value looks like an
integer (#48)
value_to_range raises InvalidArgumentError if the value does not look
like a type of range and :strict mode is enabled
Diffstat (limited to 'test/option_test.rb')
-rw-r--r-- | test/option_test.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/option_test.rb b/test/option_test.rb index eff283b..0daaa0c 100644 --- a/test/option_test.rb +++ b/test/option_test.rb @@ -66,6 +66,10 @@ class OptionTest < TestCase assert_equal (1...10), option_value(%w/-r 1...10/, :r=, :as => Range) assert_equal (-1..10), option_value(%w/-r -1..10/, :r=, :as => Range) assert_equal (1..-10), option_value(%w/-r 1..-10/, :r=, :as => Range) + assert_equal (1..1), option_value(%w/-r 1/, :r=, :as => Range) + + opts = Slop.new(:strict => true) { on :r=, :as => Range } + assert_raises(Slop::InvalidArgumentError) { opts.parse %w/-r abc/ } end test "array type cast" do |