test/test_command.rb in cri-2.6.0 vs test/test_command.rb in cri-2.6.1

- old
+ new

@@ -251,19 +251,33 @@ assert_equal [ 'sub' ], lines(out) assert_equal [ ], lines(err) end def test_help_nested + def $stdout.tty? ; true ; end + help = nested_cmd.subcommands.find { |cmd| cmd.name == 'sub' }.help assert help.include?("USAGE\e[0m\e[0m\n \e[32msuper\e[0m \e[32msub\e[0m [options]\n") end + def test_help_with_and_without_colors + def $stdout.tty? ; true ; end + help_on_tty = simple_cmd.help + def $stdout.tty? ; false ; end + help_not_on_tty = simple_cmd.help + + assert_includes help_on_tty, "\e[31mUSAGE\e[0m\e[0m\n \e[32mmoo" + assert_includes help_not_on_tty, "USAGE\n moo" + end + def test_help_for_bare_cmd bare_cmd.help end def test_help_with_optional_options + def $stdout.tty? ; true ; end + cmd = Cri::Command.define do name 'build' flag :s, nil, 'short' flag nil, :long, 'long' end