Hello community,

here is the log from the commit of package rubygem-cri for openSUSE:Factory 
checked in at 2019-07-22 12:20:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-cri (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-cri.new.4126 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-cri"

Mon Jul 22 12:20:37 2019 rev:10 rq:717289 version:2.15.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-cri/rubygem-cri.changes  2019-06-19 
20:59:38.986048236 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-cri.new.4126/rubygem-cri.changes        
2019-07-22 12:20:38.555660397 +0200
@@ -1,0 +2,77 @@
+Fri Jul 19 09:02:00 UTC 2019 - Stephan Kulow <[email protected]>
+
+- updated to version 2.15.9
+ see installed NEWS.md
+
+  ## 2.15.9
+  
+  Fixes:
+  
+  * Fixed bug which could cause options from one command appear in other 
commands (#101, #102)
+  
+  ## 2.15.8
+  
+  Fixes:
+  
+  * Don’t explicitly set default values for options (#99)
+  
+  This release reverts a backwards-incompatible change introduced in 2.15.7.
+  
+  To illustrate this, compare the behavior of the following command in recent 
versions of Cri:
+  
+  ```ruby
+  option :f, :force, 'use force', argument: :forbidden
+  
+  run do |opts, args, cmd|
+    puts "Options = #{opts.inspect}"
+    puts "Force? #{opts[:force]}"
+    puts "Option given? #{opts.key?(:force)}"
+  end
+  ```
+  
+  In Cri 2.15.6, the default is not set in the options hash, so the value is 
`nil` and `#key?` returns false:
+  
+  ```sh
+  % ./run
+  Options = {}
+  Force? nil
+  Option given? false
+  ```
+  
+  This behavior was inconsistent with what was documented: flag options were 
(and still are) documented to default to `false` rather than `nil`.
+  
+  In Cri 2.15.7, the default value is `false`, and explicitly set in the 
options hash (`#key?` returns `true`):
+  
+  ```sh
+  % ./run
+  Options = {:force=>false}
+  Force? false
+  Option given? true
+  ```
+  
+  This change made it impossible to detect options that were not explicitly 
specified, because the behavior of `#key?` also changed.
+  
+  In Cri 2.15.8, the default value is also `false` (as in 2.15.7), but not 
explicitly set in the options hash (`#key?` returns `false`, as in 2.15.6):
+  
+  ```sh
+  % ./run
+  Options = {}
+  Force? false
+  Option given? false
+  ```
+  
+  This backwards-incompatible change was not intentional. To fix issue #94, a 
change in behavior was needed, but this change also affected other, 
previously-undefined behavior. The new behavior in 2.15.8 should fix the bug 
fixed in 2.15.7 (#94, #96), without causing the problems introduced in that 
version.
+  
+  ## 2.15.7
+  
+  Fixes:
+  
+  * Options with a forbidden argument now default to false, rather than nil 
(#94, #96)
+  
+  ## 2.15.6
+  
+  Fixes:
+  
+  * Fixed problem with help header not being shown if the summary is missing 
(#93)
+
+-------------------------------------------------------------------

Old:
----
  cri-2.15.5.gem

New:
----
  cri-2.15.9.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-cri.spec ++++++
--- /var/tmp/diff_new_pack.GEwEHZ/_old  2019-07-22 12:20:39.067660263 +0200
+++ /var/tmp/diff_new_pack.GEwEHZ/_new  2019-07-22 12:20:39.071660262 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-cri
-Version:        2.15.5
+Version:        2.15.9
 Release:        0
 %define mod_name cri
 %define mod_full_name %{mod_name}-%{version}

++++++ cri-2.15.5.gem -> cri-2.15.9.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Gemfile new/Gemfile
--- old/Gemfile 2019-04-29 23:57:46.000000000 +0200
+++ new/Gemfile 2019-06-14 21:07:31.000000000 +0200
@@ -5,6 +5,7 @@
 gemspec
 
 gem 'coveralls'
+gem 'm', '~> 1.5'
 gem 'minitest'
 gem 'rake'
 gem 'rubocop'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Gemfile.lock new/Gemfile.lock
--- old/Gemfile.lock    2019-04-29 23:57:46.000000000 +0200
+++ new/Gemfile.lock    2019-06-14 21:07:31.000000000 +0200
@@ -1,35 +1,39 @@
 PATH
   remote: .
   specs:
-    cri (2.15.5)
+    cri (2.15.9)
 
 GEM
   remote: https://rubygems.org/
   specs:
     ast (2.4.0)
-    coveralls (0.8.22)
+    coveralls (0.8.23)
       json (>= 1.8, < 3)
       simplecov (~> 0.16.1)
       term-ansicolor (~> 1.3)
-      thor (~> 0.19.4)
+      thor (>= 0.19.4, < 2.0)
       tins (~> 1.6)
-    docile (1.3.1)
+    docile (1.3.2)
     jaro_winkler (1.5.2)
     json (2.2.0)
+    m (1.5.1)
+      method_source (>= 0.6.7)
+      rake (>= 0.9.2.2)
+    method_source (0.9.2)
     minitest (5.11.3)
     parallel (1.17.0)
     parser (2.6.3.0)
       ast (~> 2.4.0)
     rainbow (3.0.0)
     rake (12.3.2)
-    rubocop (0.68.0)
+    rubocop (0.71.0)
       jaro_winkler (~> 1.5.1)
       parallel (~> 1.10)
-      parser (>= 2.5, != 2.5.1.1)
+      parser (>= 2.6)
       rainbow (>= 2.2.2, < 4.0)
       ruby-progressbar (~> 1.7)
-      unicode-display_width (>= 1.4.0, < 1.6)
-    ruby-progressbar (1.10.0)
+      unicode-display_width (>= 1.4.0, < 1.7)
+    ruby-progressbar (1.10.1)
     simplecov (0.16.1)
       docile (~> 1.1)
       json (>= 1.8, < 3)
@@ -37,9 +41,9 @@
     simplecov-html (0.10.2)
     term-ansicolor (1.7.1)
       tins (~> 1.0)
-    thor (0.19.4)
-    tins (1.20.2)
-    unicode-display_width (1.5.0)
+    thor (0.20.3)
+    tins (1.20.3)
+    unicode-display_width (1.6.0)
     yard (0.9.19)
 
 PLATFORMS
@@ -48,10 +52,11 @@
 DEPENDENCIES
   coveralls
   cri!
+  m (~> 1.5)
   minitest
   rake
   rubocop
   yard
 
 BUNDLED WITH
-   2.0.1
+   2.0.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/NEWS.md new/NEWS.md
--- old/NEWS.md 2019-04-29 23:57:46.000000000 +0200
+++ new/NEWS.md 2019-06-14 21:07:31.000000000 +0200
@@ -1,5 +1,76 @@
 # Cri News
 
+## 2.15.9
+
+Fixes:
+
+* Fixed bug which could cause options from one command appear in other 
commands (#101, #102)
+
+## 2.15.8
+
+Fixes:
+
+* Don’t explicitly set default values for options (#99)
+
+This release reverts a backwards-incompatible change introduced in 2.15.7.
+
+To illustrate this, compare the behavior of the following command in recent 
versions of Cri:
+
+```ruby
+option :f, :force, 'use force', argument: :forbidden
+
+run do |opts, args, cmd|
+  puts "Options = #{opts.inspect}"
+  puts "Force? #{opts[:force]}"
+  puts "Option given? #{opts.key?(:force)}"
+end
+```
+
+In Cri 2.15.6, the default is not set in the options hash, so the value is 
`nil` and `#key?` returns false:
+
+```sh
+% ./run
+Options = {}
+Force? nil
+Option given? false
+```
+
+This behavior was inconsistent with what was documented: flag options were 
(and still are) documented to default to `false` rather than `nil`.
+
+In Cri 2.15.7, the default value is `false`, and explicitly set in the options 
hash (`#key?` returns `true`):
+
+```sh
+% ./run
+Options = {:force=>false}
+Force? false
+Option given? true
+```
+
+This change made it impossible to detect options that were not explicitly 
specified, because the behavior of `#key?` also changed.
+
+In Cri 2.15.8, the default value is also `false` (as in 2.15.7), but not 
explicitly set in the options hash (`#key?` returns `false`, as in 2.15.6):
+
+```sh
+% ./run
+Options = {}
+Force? false
+Option given? false
+```
+
+This backwards-incompatible change was not intentional. To fix issue #94, a 
change in behavior was needed, but this change also affected other, 
previously-undefined behavior. The new behavior in 2.15.8 should fix the bug 
fixed in 2.15.7 (#94, #96), without causing the problems introduced in that 
version.
+
+## 2.15.7
+
+Fixes:
+
+* Options with a forbidden argument now default to false, rather than nil 
(#94, #96)
+
+## 2.15.6
+
+Fixes:
+
+* Fixed problem with help header not being shown if the summary is missing 
(#93)
+
 ## 2.15.5
 
 Fixes:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2019-04-29 23:57:46.000000000 +0200
+++ new/README.md       2019-06-14 21:07:31.000000000 +0200
@@ -14,6 +14,13 @@
 
 Cri requires Ruby 2.3 or newer.
 
+## Compatibility policy
+
+Cri is guaranteed to be supported on any [officially supported Ruby 
version](https://www.ruby-lang.org/en/downloads/branches/), as well as the 
version of Ruby that comes by default on
+
+* the last two [Ubuntu LTS releases](https://wiki.ubuntu.com/Releases)
+* the last two major [macOS 
releases](https://en.wikipedia.org/wiki/MacOS_version_history)
+
 ## Usage
 
 The central concept in Cri is the _command_, which has option definitions as
@@ -260,6 +267,33 @@
     -a --animal[=<value>]      add animal (default: giraffe)
 ```
 
+If the option is not given on the command line, the `options` hash will not 
have key for this option, but will still have a default value:
+
+```ruby
+option :a, :animal, 'add animal', default: 'giraffe', argument: :required
+
+run do |opts, args, cmd|
+  puts "Animal = #{opts[:animal]}"
+  puts "Option given? #{opts.key?(:animal)}"
+end
+```
+
+```sh
+% ./run --animal=donkey
+Animal = donkey
+Option given? true
+
+% ./run --animal=giraffe
+Animal = giraffe
+Option given? true
+
+% ./run
+Animal = giraffe
+Option given? false
+```
+
+This can be useful to distinguish between an explicitly-passed-in value and a 
default value. In the example above, the `animal` option is set to `giraffe` in 
the second and third cases, but it is possible to detect whether the value is a 
default or not.
+
 #### Multivalued options (`multiple:`)
 
 The `:multiple` parameter allows an option to be specified more than once on 
the command line. When set to `true`, multiple option valus are accepted, and 
the option values will be stored in an array.
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/cri/command.rb new/lib/cri/command.rb
--- old/lib/cri/command.rb      2019-04-29 23:57:46.000000000 +0200
+++ new/lib/cri/command.rb      2019-06-14 21:07:31.000000000 +0200
@@ -345,6 +345,7 @@
         handle_errors_while { parser.run }
         local_opts  = parser.options
         global_opts = parent_opts.merge(parser.options)
+        global_opts = add_defaults(global_opts)
 
         # Handle options
         handle_options(local_opts)
@@ -359,6 +360,14 @@
       block.call(global_opts, args, self)
     end
 
+    def all_opt_defns
+      if supercommand
+        supercommand.all_opt_defns | option_definitions
+      else
+        option_definitions
+      end
+    end
+
     # @return [String] The help text for this command
     #
     # @option params [Boolean] :verbose true if the help output should be
@@ -428,5 +437,23 @@
       warn "#{name}: #{e.message}"
       raise CriExitException.new(is_error: true)
     end
+
+    def add_defaults(options)
+      all_opt_defns_by_key =
+        all_opt_defns.each_with_object({}) do |opt_defn, hash|
+          key = (opt_defn.long || opt_defn.short).to_sym
+          hash[key] = opt_defn
+        end
+
+      new_options = Hash.new do |hash, key|
+        hash.fetch(key) { all_opt_defns_by_key[key]&.default }
+      end
+
+      options.each do |key, value|
+        new_options[key] = value
+      end
+
+      new_options
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/cri/help_renderer.rb new/lib/cri/help_renderer.rb
--- old/lib/cri/help_renderer.rb        2019-04-29 23:57:46.000000000 +0200
+++ new/lib/cri/help_renderer.rb        2019-06-14 21:07:31.000000000 +0200
@@ -45,10 +45,16 @@
     end
 
     def append_summary(text)
-      return if @cmd.summary.nil?
+      return if @cmd.name.nil?
 
       text << fmt.format_as_title('name', @io) << "\n"
-      text << "    #{fmt.format_as_command(@cmd.name, @io)} - #{@cmd.summary}" 
<< "\n"
+
+      text << '    ' << fmt.format_as_command(@cmd.name, @io)
+      if @cmd.summary
+        text << ' - ' << @cmd.summary
+      end
+      text << "\n"
+
       unless @cmd.aliases.empty?
         text << '    aliases: ' << @cmd.aliases.map { |a| 
fmt.format_as_command(a, @io) }.join(' ') << "\n"
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/cri/option_definition.rb 
new/lib/cri/option_definition.rb
--- old/lib/cri/option_definition.rb    2019-04-29 23:57:46.000000000 +0200
+++ new/lib/cri/option_definition.rb    2019-06-14 21:07:31.000000000 +0200
@@ -31,6 +31,8 @@
       if @default && @argument == :forbidden
         raise ArgumentError, 'a default value cannot be specified for flag 
options'
       end
+
+      @default = false if @argument == :forbidden
     end
 
     def to_h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/cri/parser.rb new/lib/cri/parser.rb
--- old/lib/cri/parser.rb       2019-04-29 23:57:46.000000000 +0200
+++ new/lib/cri/parser.rb       2019-06-14 21:07:31.000000000 +0200
@@ -118,8 +118,6 @@
         end
       end
 
-      add_defaults
-
       self
     ensure
       @running = false
@@ -133,10 +131,6 @@
 
     private
 
-    def add_defaults
-      @option_defns.each { |d| add_default_option(d) }
-    end
-
     def handle_dashdash(elem)
       add_argument(elem)
       @no_more_options = true
@@ -223,16 +217,6 @@
       delegate&.option_added(key, value, self)
     end
 
-    def add_default_option(option_defn)
-      key = key_for(option_defn)
-      return if options.key?(key)
-
-      value = option_defn.default
-      return unless value
-
-      add_option(option_defn, value, transform: false)
-    end
-
     def transform_value(option_defn, value)
       transformer = option_defn.transform
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/cri/version.rb new/lib/cri/version.rb
--- old/lib/cri/version.rb      2019-04-29 23:57:46.000000000 +0200
+++ new/lib/cri/version.rb      2019-06-14 21:07:31.000000000 +0200
@@ -2,5 +2,5 @@
 
 module Cri
   # The current Cri version.
-  VERSION = '2.15.5'
+  VERSION = '2.15.9'
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2019-04-29 23:57:46.000000000 +0200
+++ new/metadata        2019-06-14 21:07:31.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: cri
 version: !ruby/object:Gem::Version
-  version: 2.15.5
+  version: 2.15.9
 platform: ruby
 authors:
 - Denis Defreyne
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2019-04-29 00:00:00.000000000 Z
+date: 2019-06-14 00:00:00.000000000 Z
 dependencies: []
 description: Cri allows building easy-to-use command-line interfaces with 
support
   for subcommands.
@@ -74,7 +74,7 @@
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubygems_version: 3.0.3
+rubygems_version: 3.0.4
 signing_key: 
 specification_version: 4
 summary: a library for building easy-to-use command-line tools
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/test_command.rb new/test/test_command.rb
--- old/test/test_command.rb    2019-04-29 23:57:46.000000000 +0200
+++ new/test/test_command.rb    2019-06-14 21:07:31.000000000 +0200
@@ -895,5 +895,110 @@
       assert_equal ['test? true!'], lines(out)
       assert_equal [], lines(err)
     end
+
+    def test_flag_defaults_to_false
+      cmd = Cri::Command.define do
+        name 'a'
+        option :f, :force2, 'push with force', argument: :forbidden
+
+        run do |opts, _args, _cmd|
+          puts "Force? #{opts[:force2].inspect}! Key present? 
#{opts.key?(:force2)}!"
+        end
+      end
+
+      out, err = capture_io_while do
+        cmd.run(%w[])
+      end
+      assert_equal ['Force? false! Key present? false!'], lines(out)
+      assert_equal [], lines(err)
+    end
+
+    def test_required_option_defaults_to_given_value
+      cmd = Cri::Command.define do
+        name 'a'
+        option :a, :animal, 'specify animal', argument: :required, default: 
'cow'
+
+        run do |opts, _args, _cmd|
+          puts "Animal = #{opts[:animal]}! Key present? #{opts.key?(:animal)}!"
+        end
+      end
+
+      out, err = capture_io_while do
+        cmd.run(%w[])
+      end
+      assert_equal ['Animal = cow! Key present? false!'], lines(out)
+      assert_equal [], lines(err)
+    end
+
+    def test_optional_option_defaults_to_given_value
+      cmd = Cri::Command.define do
+        name 'a'
+        option :a, :animal, 'specify animal', argument: :optional, default: 
'cow'
+
+        run do |opts, _args, _cmd|
+          puts "Animal = #{opts[:animal]}"
+        end
+      end
+
+      out, err = capture_io_while do
+        cmd.run(%w[])
+      end
+      assert_equal ['Animal = cow'], lines(out)
+      assert_equal [], lines(err)
+    end
+
+    def test_required_option_defaults_to_given_value_with_transform
+      cmd = Cri::Command.define do
+        name 'a'
+        option :a, :animal, 'specify animal', argument: :required, transform: 
->(a) { a.upcase }, default: 'cow'
+
+        run do |opts, _args, _cmd|
+          puts "Animal = #{opts[:animal]}"
+        end
+      end
+
+      out, err = capture_io_while do
+        cmd.run(%w[])
+      end
+      assert_equal ['Animal = cow'], lines(out)
+      assert_equal [], lines(err)
+    end
+
+    def test_option_definitions_are_not_shared_across_commands
+      root_cmd = Cri::Command.define do
+        name 'root'
+        option :r, :rrr, 'Rrr!', argument: :required
+      end
+
+      subcmd_a = root_cmd.define_command do
+        name 'a'
+        option :a, :aaa, 'Aaa!', argument: :required
+
+        run do |_opts, _args, cmd|
+          puts cmd.all_opt_defns.map(&:long).sort.join(',')
+        end
+      end
+
+      subcmd_b = root_cmd.define_command do
+        name 'b'
+        option :b, :bbb, 'Bbb!', argument: :required
+
+        run do |_opts, _args, cmd|
+          puts cmd.all_opt_defns.map(&:long).sort.join(',')
+        end
+      end
+
+      out, err = capture_io_while do
+        subcmd_a.run(%w[])
+      end
+      assert_equal ['aaa,rrr'], lines(out)
+      assert_equal [], lines(err)
+
+      out, err = capture_io_while do
+        subcmd_b.run(%w[])
+      end
+      assert_equal ['bbb,rrr'], lines(out)
+      assert_equal [], lines(err)
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/test_command_dsl.rb new/test/test_command_dsl.rb
--- old/test/test_command_dsl.rb        2019-04-29 23:57:46.000000000 +0200
+++ new/test/test_command_dsl.rb        2019-06-14 21:07:31.000000000 +0200
@@ -41,12 +41,12 @@
       expected_option_definitions =
         Set.new(
           [
-            { short: 'a', long: 'aaa', desc: 'opt a', argument: :optional,  
multiple: true,  hidden: false, block: nil, default: nil, transform: nil },
-            { short: 'b', long: 'bbb', desc: 'opt b', argument: :required,  
multiple: false, hidden: false, block: nil, default: nil, transform: nil },
-            { short: 'c', long: 'ccc', desc: 'opt c', argument: :optional,  
multiple: false, hidden: false, block: nil, default: nil, transform: nil },
-            { short: 'd', long: 'ddd', desc: 'opt d', argument: :forbidden, 
multiple: false, hidden: false, block: nil, default: nil, transform: nil },
-            { short: 'e', long: 'eee', desc: 'opt e', argument: :forbidden, 
multiple: false, hidden: false, block: nil, default: nil, transform: nil },
-            { short: 'f', long: 'fff', desc: 'opt f', argument: :forbidden, 
multiple: false, hidden: true,  block: nil, default: nil, transform: nil },
+            { short: 'a', long: 'aaa', desc: 'opt a', argument: :optional,  
multiple: true,  hidden: false, block: nil, default: nil,   transform: nil },
+            { short: 'b', long: 'bbb', desc: 'opt b', argument: :required,  
multiple: false, hidden: false, block: nil, default: nil,   transform: nil },
+            { short: 'c', long: 'ccc', desc: 'opt c', argument: :optional,  
multiple: false, hidden: false, block: nil, default: nil,   transform: nil },
+            { short: 'd', long: 'ddd', desc: 'opt d', argument: :forbidden, 
multiple: false, hidden: false, block: nil, default: false, transform: nil },
+            { short: 'e', long: 'eee', desc: 'opt e', argument: :forbidden, 
multiple: false, hidden: false, block: nil, default: false, transform: nil },
+            { short: 'f', long: 'fff', desc: 'opt f', argument: :forbidden, 
multiple: false, hidden: true,  block: nil, default: false, transform: nil },
           ],
         )
       actual_option_definitions = 
Set.new(command.option_definitions.map(&:to_h))
@@ -80,8 +80,8 @@
       expected_option_definitions =
         Set.new(
           [
-            { short: 's', long: nil,    desc: 'short', argument: :forbidden, 
multiple: false, hidden: false, block: nil, default: nil, transform: nil },
-            { short: nil, long: 'long', desc: 'long',  argument: :forbidden, 
multiple: false, hidden: false, block: nil, default: nil, transform: nil },
+            { short: 's', long: nil,    desc: 'short', argument: :forbidden, 
multiple: false, hidden: false, block: nil, default: false, transform: nil },
+            { short: nil, long: 'long', desc: 'long',  argument: :forbidden, 
multiple: false, hidden: false, block: nil, default: false, transform: nil },
           ],
         )
       actual_option_definitions = 
Set.new(command.option_definitions.map(&:to_h))
@@ -104,9 +104,9 @@
       expected_option_definitions =
         Set.new(
           [
-            { short: 'f', long: 'flag',     desc: 'flag', argument: 
:forbidden, multiple: true, hidden: false, block: nil, default: nil, transform: 
nil },
-            { short: 'r', long: 'required', desc: 'req',  argument: :required, 
 multiple: true, hidden: false, block: nil, default: nil, transform: nil },
-            { short: 'o', long: 'optional', desc: 'opt',  argument: :optional, 
 multiple: true, hidden: false, block: nil, default: nil, transform: nil },
+            { short: 'f', long: 'flag',     desc: 'flag', argument: 
:forbidden, multiple: true, hidden: false, block: nil, default: false, 
transform: nil },
+            { short: 'r', long: 'required', desc: 'req',  argument: :required, 
 multiple: true, hidden: false, block: nil, default: nil,   transform: nil },
+            { short: 'o', long: 'optional', desc: 'opt',  argument: :optional, 
 multiple: true, hidden: false, block: nil, default: nil,   transform: nil },
           ],
         )
       actual_option_definitions = 
Set.new(command.option_definitions.map(&:to_h))
@@ -129,9 +129,9 @@
       expected_option_definitions =
         Set.new(
           [
-            { short: 'f', long: 'flag',     desc: 'flag', argument: 
:forbidden, multiple: false, hidden: true, block: nil, default: nil, transform: 
nil },
-            { short: 'r', long: 'required', desc: 'req',  argument: :required, 
 multiple: false, hidden: true, block: nil, default: nil, transform: nil },
-            { short: 'o', long: 'optional', desc: 'opt',  argument: :optional, 
 multiple: false, hidden: true, block: nil, default: nil, transform: nil },
+            { short: 'f', long: 'flag',     desc: 'flag', argument: 
:forbidden, multiple: false, hidden: true, block: nil, default: false, 
transform: nil },
+            { short: 'r', long: 'required', desc: 'req',  argument: :required, 
 multiple: false, hidden: true, block: nil, default: nil,   transform: nil },
+            { short: 'o', long: 'optional', desc: 'opt',  argument: :optional, 
 multiple: false, hidden: true, block: nil, default: nil,   transform: nil },
           ],
         )
       actual_option_definitions = 
Set.new(command.option_definitions.map(&:to_h))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/test_help_renderer.rb 
new/test/test_help_renderer.rb
--- old/test/test_help_renderer.rb      2019-04-29 23:57:46.000000000 +0200
+++ new/test/test_help_renderer.rb      2019-06-14 21:07:31.000000000 +0200
@@ -43,5 +43,30 @@
 
       assert_match(/^       --with-animal\[=<value>\]      Add animal 
\(default: giraffe\)$/, help)
     end
+
+    def test_with_summary
+      cmd = Cri::Command.define do
+        name 'build'
+        summary 'do some buildage'
+
+        optional nil, :'with-animal', 'Add animal', default: 'giraffe'
+      end
+
+      help = help_for(cmd)
+
+      assert_match(/^NAME\n    build - do some buildage\n$/, help)
+    end
+
+    def test_without_summary
+      cmd = Cri::Command.define do
+        name 'build'
+
+        optional nil, :'with-animal', 'Add animal', default: 'giraffe'
+      end
+
+      help = help_for(cmd)
+
+      assert_match(/^NAME\n    build\n$/, help)
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/test_parser.rb new/test/test_parser.rb
--- old/test/test_parser.rb     2019-04-29 23:57:46.000000000 +0200
+++ new/test/test_parser.rb     2019-06-14 21:07:31.000000000 +0200
@@ -284,18 +284,6 @@
       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 = [
@@ -319,18 +307,6 @@
       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 = [
@@ -451,26 +427,6 @@
       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]
       opt_defns = [


Reply via email to