diff options
author | Lee Jarvis <lee@jarvis.co> | 2011-03-30 13:38:38 +0100 |
---|---|---|
committer | Lee Jarvis <lee@jarvis.co> | 2011-03-30 13:38:38 +0100 |
commit | b0ca6d3abeae284e1b98f0ee1ba7dac7e6813a1d (patch) | |
tree | 9eb9f2a9a499c8fef757d4b382877622fd81aa69 /test/option_test.rb | |
parent | 059500ff7025774e7c087d387d45209eeb156846 (diff) | |
download | slop-b0ca6d3abeae284e1b98f0ee1ba7dac7e6813a1d.tar.gz |
do not type coerce nil arguments
Diffstat (limited to 'test/option_test.rb')
-rw-r--r-- | test/option_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/option_test.rb b/test/option_test.rb index 6eb124d..422e696 100644 --- a/test/option_test.rb +++ b/test/option_test.rb @@ -104,4 +104,12 @@ class OptionTest < TestCase assert_raises(Slop::InvalidArgumentError, /world/) { slop.parse %w/--foo world/ } assert slop.parse %w/--foo hello/ end + + test 'non-casting of nil options' do + slop = Slop.new { on :f, :foo, true, :as => String } + slop.parse [] + + assert_equal nil, slop[:foo] + refute_equal "", slop[:foo] + end end |