summaryrefslogtreecommitdiff
path: root/test/option_test.rb
diff options
context:
space:
mode:
authorLee Jarvis <lee@jarvis.co>2011-03-30 13:38:38 +0100
committerLee Jarvis <lee@jarvis.co>2011-03-30 13:38:38 +0100
commitb0ca6d3abeae284e1b98f0ee1ba7dac7e6813a1d (patch)
tree9eb9f2a9a499c8fef757d4b382877622fd81aa69 /test/option_test.rb
parent059500ff7025774e7c087d387d45209eeb156846 (diff)
downloadslop-b0ca6d3abeae284e1b98f0ee1ba7dac7e6813a1d.tar.gz
do not type coerce nil arguments
Diffstat (limited to 'test/option_test.rb')
-rw-r--r--test/option_test.rb8
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