fedora-migrator /vendor/gems/facets-2.4.5/test/more/test_command.rb

Language Ruby Lines 70
MD5 Hash 1f68c73fc6860298ab276c4afec2916c Estimated Cost $848 (why?)
Repository https://bitbucket.org/mediashelf/fedora-migrator View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
Back to Top