test/test_command.rb in cri-2.4.0 vs test/test_command.rb in cri-2.4.1
- old
+ new
@@ -274,10 +274,16 @@
assert_match(/--long.*-s/m, help)
assert_match(/^\e\[33m --long \e\[0mlong$/, help)
assert_match(/^\e\[33m -s \e\[0mshort$/, help)
end
+ def test_help_with_multiple_groups
+ help = nested_cmd.subcommands.find { |cmd| cmd.name == 'sub' }.help
+
+ assert_match(/OPTIONS.*OPTIONS FOR SUPER/m, help)
+ end
+
def test_modify_with_block_argument
cmd = Cri::Command.define do |c|
c.name 'build'
end
assert_equal 'build', cmd.name
@@ -367,25 +373,32 @@
c.name 'old-and-deprecated'
c.summary 'does stuff the ancient, totally deprecated way'
c.be_hidden
end
- refute cmd.help.include?('hidden commands ommitted')
- assert cmd.help.include?('hidden command ommitted')
+ refute cmd.help.include?('hidden commands omitted')
+ assert cmd.help.include?('hidden command omitted')
refute cmd.help.include?('old-and-deprecated')
- refute cmd.help(:verbose => true).include?('hidden commands ommitted')
- refute cmd.help(:verbose => true).include?('hidden command ommitted')
+ refute cmd.help(:verbose => true).include?('hidden commands omitted')
+ refute cmd.help(:verbose => true).include?('hidden command omitted')
assert cmd.help(:verbose => true).include?('old-and-deprecated')
end
def test_hidden_commands_multiple
cmd = nested_cmd
subcmd = simple_cmd
cmd.add_command subcmd
subcmd.modify do |c|
+ c.name 'first'
+ c.summary 'does stuff first'
+ end
+
+ subcmd = simple_cmd
+ cmd.add_command subcmd
+ subcmd.modify do |c|
c.name 'old-and-deprecated'
c.summary 'does stuff the old, deprecated way'
c.be_hidden
end
@@ -395,17 +408,20 @@
c.name 'ancient-and-deprecated'
c.summary 'does stuff the ancient, reallydeprecated way'
c.be_hidden
end
- assert cmd.help.include?('hidden commands ommitted')
- refute cmd.help.include?('hidden command ommitted')
+ assert cmd.help.include?('hidden commands omitted')
+ refute cmd.help.include?('hidden command omitted')
refute cmd.help.include?('old-and-deprecated')
refute cmd.help.include?('ancient-and-deprecated')
- refute cmd.help(:verbose => true).include?('hidden commands ommitted')
- refute cmd.help(:verbose => true).include?('hidden command ommitted')
+ refute cmd.help(:verbose => true).include?('hidden commands omitted')
+ refute cmd.help(:verbose => true).include?('hidden command omitted')
assert cmd.help(:verbose => true).include?('old-and-deprecated')
assert cmd.help(:verbose => true).include?('ancient-and-deprecated')
+
+ pattern = /ancient-and-deprecated.*first.*old-and-deprecated/m
+ assert_match(pattern, cmd.help(:verbose => true))
end
end