Sha256: 0c312f2ce01450e2cd62ef3eb71087964eed924342baa7de7586379af3d8a028
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
require 'helper' module Cri class HelpRendererTestCase < Cri::TestCase # NOTE: Additional test cases are in test_command.rb def help_for(cmd) io = StringIO.new Cri::HelpRenderer.new(cmd, io: io).render end def test_simple expected = <<EOS NAME help - show help USAGE help [command_name] DESCRIPTION Show help for the given command, or show general help. When no command is given, a list of available commands is displayed, as well as a list of global command-line options. When a command is given, a command description, as well as command-specific command-line options, are shown. OPTIONS -v --verbose show more detailed help EOS cmd = Cri::Command.new_basic_help assert_equal(expected, help_for(cmd)) end def test_with_defaults cmd = Cri::Command.define do name 'build' optional nil, :'with-animal', 'Add animal', default: 'giraffe' end help = help_for(cmd) assert_match(/^ --with-animal\[=<value>\] Add animal \(default: giraffe\)$/, help) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cri-2.10.1 | test/test_help_renderer.rb |
cri-2.10.0 | test/test_help_renderer.rb |
cri-2.9.1 | test/test_help_renderer.rb |
cri-2.9.0 | test/test_help_renderer.rb |