Sha256: ed4ec2cbd5d8bbdfd7e57dbacd45e786bab2f13acd3a2641554f913aacad941c

Contents?: true

Size: 984 Bytes

Versions: 3

Compression:

Stored size: 984 Bytes

Contents

require 'facets/command'
require 'test/unit'

class TC_Command_Simple < Test::Unit::TestCase

  #
  # Test simple, single funciton command.
  #

  class SimpleCommand < CLI::Command

    def call
      "hello"
    end

  end

  def test_simple
    assert_equal("hello", SimpleCommand.start)
  end

end

#
# Test dispatching commands (aka Master Commands).
#

class TC_Command_Dispatch < Test::Unit::TestCase

  class ComplexCommand < CLI::Command

    def sink
      "sink"
    end

    def swim
      "swim"
    end

  end

  def test_complex
    assert_equal("swim", ComplexCommand.start(['swim']))
  end

end

#
# Test subcommand convenience method.
#

class TC_Command_Subcommand < Test::Unit::TestCase

  include Console

  class SubCommand < CLI::Command
    def call ; 'submarine' ; end
  end

  class ComplexCommand < CLI::Command
    subcommand :submariner, SubCommand
  end

  def test_complex
    assert_equal("submarine", ComplexCommand.start(['submariner']))
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-2.4.3 test/more/test_command.rb
facets-2.4.4 test/more/test_command.rb
facets-2.4.5 test/more/test_command.rb