diff options
author | Lee Jarvis <ljjarvis@gmail.com> | 2013-06-16 09:42:31 +0100 |
---|---|---|
committer | Lee Jarvis <ljjarvis@gmail.com> | 2013-08-13 20:34:43 +0100 |
commit | 6e41cbac607029ef6739da3a7b6c39036fd4ac6c (patch) | |
tree | 876f71ec13a49a43d6df53b7e228cec12ae415ae /test/option_test.rb | |
parent | 7d62cc1b72e19b965fd313f2712db2fa4853fb33 (diff) | |
download | slop-6e41cbac607029ef6739da3a7b6c39036fd4ac6c.tar.gz |
Slop is now strict by default, and adds --help by default
Also use 1.9 hash syntax
Diffstat (limited to 'test/option_test.rb')
-rw-r--r-- | test/option_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/option_test.rb b/test/option_test.rb index c26fc0c..c57126d 100644 --- a/test/option_test.rb +++ b/test/option_test.rb @@ -7,7 +7,7 @@ class OptionTest < TestCase def option_with_argument(*args, &block) options = args.shift - slop = Slop.new + slop = Slop.new(strict: false, help: false) option = slop.opt(*args) slop.parse(options) slop.options.find {|opt| opt.key == option.key } @@ -57,12 +57,12 @@ class OptionTest < TestCase opts.parse %w'-f 1' assert_equal 1, opts[:f] - opts = Slop.new(:strict => true) { on :r=, :as => Integer } + opts = Slop.new { 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 } + opts = Slop.new { on :r=, :as => Float } assert_raises(Slop::InvalidArgumentError) { opts.parse %w/-r abc/ } end @@ -80,7 +80,7 @@ class OptionTest < TestCase assert_equal((1..1), option_value(%w/-r 1/, :r=, :as => Range)) assert_equal((-1..10), option_value(%w/-r -1..10/, :r, :as => Range, :optional_argument => true)) - opts = Slop.new(:strict => true) { on :r=, :as => Range } + opts = Slop.new { on :r=, :as => Range } assert_raises(Slop::InvalidArgumentError) { opts.parse %w/-r abc/ } end |