summaryrefslogtreecommitdiff
path: root/test/option_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/option_test.rb')
-rw-r--r--test/option_test.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/option_test.rb b/test/option_test.rb
index c888073..dc7e987 100644
--- a/test/option_test.rb
+++ b/test/option_test.rb
@@ -56,6 +56,14 @@ class OptionTest < TestCase
opts.on :f=, :as => Integer
opts.parse %w'-f 1'
assert_equal 1, opts[:f]
+
+ opts = Slop.new(:strict => true) { on :r=, :as => Integer }
+ assert_raises(Slop::InvalidArgumentError) { opts.parse %w/-r abc/ }
+ end
+
+ test "float type cast" do
+ opts = Slop.new(:strict => true) { on :r=, :as => Float }
+ assert_raises(Slop::InvalidArgumentError) { opts.parse %w/-r abc/ }
end
test "symbol type cast" do
@@ -115,4 +123,4 @@ class OptionTest < TestCase
slop.on :foo, :help => ' -f, --foo SOMETHING FOOEY'
assert_equal ' -f, --foo SOMETHING FOOEY', slop.fetch_option(:foo).help
end
-end \ No newline at end of file
+end