test/test_parser.rb in cri-2.15.6 vs test/test_parser.rb in cri-2.15.7
- old
+ new
@@ -282,22 +282,10 @@
assert_equal(%w[test test2], parser.options[:long])
assert_equal(3, parser.options[:verbose].size)
end
- def test_parse_with_default_required_unspecified
- input = %w[foo]
- opt_defns = [
- { long: 'animal', short: 'a', argument: :required, default: 'donkey' },
- ].map { |hash| make_opt_defn(hash) }
-
- parser = Cri::Parser.new(input, opt_defns, [], false).run
-
- assert_equal({ animal: 'donkey' }, parser.options)
- assert_equal(['foo'], parser.gen_argument_list.to_a)
- end
-
def test_parse_with_default_required_no_value
input = %w[foo -a]
opt_defns = [
{ long: 'animal', short: 'a', argument: :required, default: 'donkey' },
].map { |hash| make_opt_defn(hash) }
@@ -317,22 +305,10 @@
assert_equal({ animal: 'giraffe' }, parser.options)
assert_equal(['foo'], parser.gen_argument_list.to_a)
end
- def test_parse_with_default_optional_unspecified
- input = %w[foo]
- opt_defns = [
- { long: 'animal', short: 'a', argument: :optional, default: 'donkey' },
- ].map { |hash| make_opt_defn(hash) }
-
- parser = Cri::Parser.new(input, opt_defns, [], false).run
-
- assert_equal({ animal: 'donkey' }, parser.options)
- assert_equal(['foo'], parser.gen_argument_list.to_a)
- end
-
def test_parse_with_default_optional_no_value
input = %w[foo -a]
opt_defns = [
{ long: 'animal', short: 'a', argument: :optional, default: 'donkey' },
].map { |hash| make_opt_defn(hash) }
@@ -446,29 +422,9 @@
].map { |hash| make_opt_defn(hash) }
parser = Cri::Parser.new(input, opt_defns, [], false).run
assert_equal({ port: 123 }, parser.options)
- assert_equal([], parser.gen_argument_list.to_a)
- end
-
- def test_parse_with_transform_default
- port = Class.new do
- def call(str)
- raise unless str.is_a?(String)
-
- Integer(str)
- end
- end.new
-
- input = %w[]
- opt_defns = [
- { long: 'port', short: 'p', argument: :required, default: 8080, transform: port },
- ].map { |hash| make_opt_defn(hash) }
-
- parser = Cri::Parser.new(input, opt_defns, [], false).run
-
- assert_equal({ port: 8080 }, parser.options)
assert_equal([], parser.gen_argument_list.to_a)
end
def test_parse_with_transform_exception
input = %w[--port one_hundred_and_twenty_three]