gli 2.18.2 → 2.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +28 -0
  3. data/.gitignore +1 -3
  4. data/.tool-versions +1 -1
  5. data/Gemfile +0 -6
  6. data/README.rdoc +33 -23
  7. data/Rakefile +21 -37
  8. data/bin/ci +29 -0
  9. data/bin/gli +25 -64
  10. data/bin/rake +29 -0
  11. data/bin/setup +5 -0
  12. data/exe/gli +68 -0
  13. data/gli.gemspec +19 -22
  14. data/gli.rdoc +2 -2
  15. data/lib/gli/command_support.rb +2 -6
  16. data/lib/gli/commands/help_modules/arg_name_formatter.rb +2 -2
  17. data/lib/gli/commands/help_modules/command_help_format.rb +1 -1
  18. data/lib/gli/commands/help_modules/global_help_format.rb +1 -1
  19. data/lib/gli/commands/scaffold.rb +9 -93
  20. data/lib/gli/dsl.rb +1 -1
  21. data/lib/gli/options.rb +2 -2
  22. data/lib/gli/version.rb +1 -1
  23. data/object-model.dot +29 -0
  24. data/object-model.png +0 -0
  25. data/test/apps/todo/Gemfile +1 -1
  26. data/test/apps/todo/bin/todo +1 -1
  27. data/test/integration/gli_cli_test.rb +69 -0
  28. data/test/integration/gli_powered_app_test.rb +52 -0
  29. data/test/integration/scaffold_test.rb +30 -0
  30. data/test/integration/test_helper.rb +52 -0
  31. data/test/{tc_command_finder.rb → unit/command_finder_test.rb} +6 -6
  32. data/test/{tc_command.rb → unit/command_test.rb} +4 -4
  33. data/test/unit/compound_command_test.rb +17 -0
  34. data/test/{tc_doc.rb → unit/doc_test.rb} +38 -51
  35. data/test/{tc_flag.rb → unit/flag_test.rb} +19 -25
  36. data/test/{tc_gli.rb → unit/gli_test.rb} +28 -47
  37. data/test/{tc_help.rb → unit/help_test.rb} +48 -107
  38. data/test/{init_simplecov.rb → unit/init_simplecov.rb} +0 -0
  39. data/test/{tc_options.rb → unit/options_test.rb} +4 -4
  40. data/test/unit/subcommand_parsing_test.rb +263 -0
  41. data/test/unit/subcommands_test.rb +245 -0
  42. data/test/{fake_std_out.rb → unit/support/fake_std_out.rb} +0 -0
  43. data/test/{config.yaml → unit/support/gli_test_config.yml} +0 -0
  44. data/test/unit/switch_test.rb +49 -0
  45. data/test/{tc_terminal.rb → unit/terminal_test.rb} +4 -3
  46. data/test/unit/test_helper.rb +13 -0
  47. data/test/unit/verbatim_wrapper_test.rb +24 -0
  48. metadata +74 -139
  49. data/.ruby-gemset +0 -1
  50. data/.ruby-version +0 -1
  51. data/.travis.yml +0 -11
  52. data/ObjectModel.graffle +0 -1191
  53. data/bin/report_on_rake_results +0 -10
  54. data/bin/test_all_rubies.sh +0 -6
  55. data/features/gli_executable.feature +0 -90
  56. data/features/gli_init.feature +0 -235
  57. data/features/step_definitions/gli_executable_steps.rb +0 -18
  58. data/features/step_definitions/gli_init_steps.rb +0 -11
  59. data/features/step_definitions/todo_steps.rb +0 -100
  60. data/features/support/env.rb +0 -54
  61. data/features/todo.feature +0 -579
  62. data/features/todo_legacy.feature +0 -130
  63. data/test/option_test_helper.rb +0 -13
  64. data/test/tc_compound_command.rb +0 -22
  65. data/test/tc_subcommand_parsing.rb +0 -280
  66. data/test/tc_subcommands.rb +0 -259
  67. data/test/tc_switch.rb +0 -55
  68. data/test/tc_verbatim_wrapper.rb +0 -36
  69. data/test/test_helper.rb +0 -21
@@ -0,0 +1,30 @@
1
+ require_relative "test_helper"
2
+ require "open3"
3
+
4
+ class ScaffoldCommandTest < MiniTest::Test
5
+ include TestHelper
6
+
7
+ def test_scaffolded_app_has_reasonable_setup
8
+ FileUtils.rm_rf "scaffold_test"
9
+ run_gli("init scaffold_test")
10
+ assert Dir.exist? "scaffold_test"
11
+ FileUtils.chdir "scaffold_test" do
12
+ run_command("bundle install", "", return_err_and_status: false, expect_failure: false)
13
+
14
+ scaffold_lib = "lib:../lib"
15
+
16
+ # help works
17
+ out = run_command("bin/scaffold_test","--help", return_err_and_status: false, expect_failure: false, rubylib: scaffold_lib)
18
+ assert_match /SYNOPSIS/,out
19
+ assert_match /GLOBAL OPTIONS/,out
20
+ assert_match /COMMANDS/,out
21
+
22
+ # can run unit tests
23
+ out = run_command("bundle exec ","rake test", return_err_and_status: false, expect_failure: false, rubylib: scaffold_lib)
24
+ assert_match /0 failures/,out
25
+ assert_match /0 errors/,out
26
+ assert_match /0 skips/,out
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,52 @@
1
+ require "minitest/autorun"
2
+ require "pathname"
3
+ require "fileutils"
4
+
5
+ # Copied from https://github.com/splattael/minitest-around
6
+ # so as to avoid an explicit dependency
7
+ Minitest::Test.class_eval do
8
+ alias_method :run_without_around, :run
9
+ def run(*args)
10
+ if defined?(around)
11
+ result = nil
12
+ around { result = run_without_around(*args) }
13
+ result
14
+ else
15
+ run_without_around(*args)
16
+ end
17
+ end
18
+ end
19
+
20
+ module TestHelper
21
+ def around(&block)
22
+ Bundler.with_original_env do
23
+ root = Pathname(__FILE__).dirname / ".." / ".."
24
+ FileUtils.chdir root do
25
+ block.()
26
+ end
27
+ end
28
+ end
29
+
30
+ def run_gli(args="", return_err_and_status: false, expect_failure: false)
31
+ run_command("bin/gli",args,return_err_and_status:return_err_and_status,expect_failure:expect_failure)
32
+ end
33
+
34
+ def run_command(command,args,return_err_and_status:,expect_failure:,rubylib:nil)
35
+ command_line_invocation = "#{command} #{args}"
36
+ env = {}
37
+ if !rubylib.nil?
38
+ env["RUBYLIB"] = rubylib
39
+ end
40
+ stdout_string, stderr_string, status = Open3.capture3(env,command_line_invocation)
41
+ if expect_failure
42
+ refute_equal 0,status.exitstatus,"Expected failure for '#{command_line_invocation}' but it succeeded"
43
+ else
44
+ assert_equal 0,status.exitstatus,"Expected success for '#{command_line_invocation}' but it failed:\n#{stdout_string}\n\n#{stderr_string}\n\n"
45
+ end
46
+ if return_err_and_status
47
+ [ stdout_string, stderr_string, status ]
48
+ else
49
+ stdout_string
50
+ end
51
+ end
52
+ end
@@ -1,6 +1,6 @@
1
- require 'test_helper'
1
+ require_relative "test_helper"
2
2
 
3
- class TC_testCommandFinder < Clean::Test::TestCase
3
+ class CommandFinderTest < MiniTest::Test
4
4
  include TestHelper
5
5
 
6
6
  def setup
@@ -14,13 +14,13 @@ class TC_testCommandFinder < Clean::Test::TestCase
14
14
  end
15
15
 
16
16
  def test_unknown_command_name
17
- assert_raise(GLI::UnknownCommand) do
17
+ assert_raises(GLI::UnknownCommand) do
18
18
  GLI::CommandFinder.new(@app.commands, :default_command => :status).find_command(:unfindable_command)
19
19
  end
20
20
  end
21
21
 
22
22
  def test_no_command_name_without_default
23
- assert_raise(GLI::UnknownCommand) do
23
+ assert_raises(GLI::UnknownCommand) do
24
24
  GLI::CommandFinder.new(@app.commands).find_command(nil)
25
25
  end
26
26
  end
@@ -33,7 +33,7 @@ class TC_testCommandFinder < Clean::Test::TestCase
33
33
  end
34
34
 
35
35
  def test_ambigous_command
36
- assert_raise(GLI::AmbiguousCommand) do
36
+ assert_raises(GLI::AmbiguousCommand) do
37
37
  GLI::CommandFinder.new(@app.commands, :default_command => :status).find_command(:some)
38
38
  end
39
39
  end
@@ -46,7 +46,7 @@ class TC_testCommandFinder < Clean::Test::TestCase
46
46
  end
47
47
 
48
48
  def test_partial_name_with_autocorrect_disabled
49
- assert_raise(GLI::UnknownCommand) do
49
+ assert_raises(GLI::UnknownCommand) do
50
50
  GLI::CommandFinder.new(@app.commands, :default_command => :status, :autocomplete => false)
51
51
  .find_command(:deploy)
52
52
  end
@@ -1,7 +1,7 @@
1
- require 'test_helper'
2
- require 'tempfile'
1
+ require_relative "test_helper"
2
+ require_relative "support/fake_std_out"
3
3
 
4
- class TC_testCommand < Clean::Test::TestCase
4
+ class CommandTest < MiniTest::Test
5
5
  include TestHelper
6
6
  def setup
7
7
  @fake_stdout = FakeStdOut.new
@@ -436,7 +436,7 @@ class TC_testCommand < Clean::Test::TestCase
436
436
  private
437
437
 
438
438
  def assert_contained(output,regexp)
439
- assert_not_nil output.contained?(regexp),
439
+ refute_nil output.contained?(regexp),
440
440
  "Expected output to contain #{regexp.inspect}, output was:\n#{output}"
441
441
  end
442
442
 
@@ -0,0 +1,17 @@
1
+ require_relative "test_helper"
2
+
3
+ class CompoundCommandFinderTest < MiniTest::Test
4
+ include TestHelper
5
+
6
+ def test_exception_for_missing_commands
7
+ @name = "new"
8
+ @unknown_name = "create"
9
+ @existing_command = OpenStruct.new(:name => @name)
10
+ @base = OpenStruct.new( :commands => { @name => @existing_command })
11
+
12
+ @code = lambda { GLI::Commands::CompoundCommand.new(@base,{:foo => [@name,@unknown_name]}) }
13
+
14
+ ex = assert_raises(RuntimeError,&@code)
15
+ assert_match /#{Regexp.escape(@unknown_name)}/,ex.message
16
+ end
17
+ end
@@ -1,5 +1,4 @@
1
- require 'test_helper'
2
- require 'pp'
1
+ require_relative "test_helper"
3
2
 
4
3
  class String
5
4
  def blank?
@@ -19,7 +18,7 @@ class Object
19
18
  end
20
19
  end
21
20
 
22
- class TC_testDoc < Clean::Test::TestCase
21
+ class DocTest < MiniTest::Test
23
22
  include TestHelper
24
23
 
25
24
  class TestApp
@@ -112,42 +111,30 @@ class TC_testDoc < Clean::Test::TestCase
112
111
  @@counter = -1 # we pre-increment so this makes 0 first
113
112
  end
114
113
 
115
- test_that "a GLI app with documentation gets the callbacks for each element" do
116
- Given :the_test_app
117
- And :the_expected_output
118
- And {
119
- @documenter = GLI::Commands::Doc.new(@app)
120
- @listener = TestListener.new
121
- }
122
- When {
123
- @documenter.document(@listener)
124
- }
125
- Then {
126
- lines_expected = @string.split(/\n/)
127
- lines_got = @listener.to_s.split(/\n/)
128
- lines_expected.zip(lines_got).each_with_index do |(expected,got),index|
129
- assert_equal expected,got,"At index #{index}"
130
- end
131
- }
114
+ def test_app_without_docs_gets_callbacks_for_each_element
115
+ setup_test_app
116
+ construct_expected_output
117
+ @documenter = GLI::Commands::Doc.new(@app)
118
+ @listener = TestListener.new
119
+ @documenter.document(@listener)
120
+ lines_expected = @string.split(/\n/)
121
+ lines_got = @listener.to_s.split(/\n/)
122
+ lines_expected.zip(lines_got).each_with_index do |(expected,got),index|
123
+ assert_equal expected,got,"At index #{index}"
124
+ end
132
125
  end
133
126
 
134
- test_that "the doc command works as a GLI command" do
135
- Given :the_test_app
136
- And :the_expected_output
137
- And {
138
- @documenter = GLI::Commands::Doc.new(@app)
139
- @listener = TestListener.new
140
- }
141
- When {
142
- @documenter.execute({},{:format => "TC_testDoc::TestListener"},[])
143
- }
144
- Then {
145
- lines_expected = @string.split(/\n/)
146
- lines_got = TestListener.last.to_s.split(/\n/)
147
- lines_expected.zip(lines_got).each_with_index do |(expected,got),index|
148
- assert_equal expected,got,"At index #{index}"
149
- end
150
- }
127
+ def test_doc_command_works_as_GLI_command
128
+ setup_test_app
129
+ construct_expected_output
130
+ @documenter = GLI::Commands::Doc.new(@app)
131
+ @listener = TestListener.new
132
+ @documenter.execute({},{:format => "DocTest::TestListener"},[])
133
+ lines_expected = @string.split(/\n/)
134
+ lines_got = TestListener.last.to_s.split(/\n/)
135
+ lines_expected.zip(lines_got).each_with_index do |(expected,got),index|
136
+ assert_equal expected,got,"At index #{index}"
137
+ end
151
138
  end
152
139
 
153
140
  private
@@ -158,36 +145,36 @@ private
158
145
  @@counter
159
146
  end
160
147
 
161
- def the_test_app
148
+ def setup_test_app
162
149
  @app = TestApp.new
163
150
  @app.instance_eval do
164
151
  program_desc "program desc"
165
152
  program_long_desc "program long desc"
166
153
  version "1.3.4"
167
154
 
168
- TC_testDoc.flag_with_everything_specified(self)
169
- TC_testDoc.flag_with_everything_omitted(self)
170
- TC_testDoc.switch_with_everything_specified(self)
171
- TC_testDoc.switch_with_everything_omitted(self)
155
+ DocTest.flag_with_everything_specified(self)
156
+ DocTest.flag_with_everything_omitted(self)
157
+ DocTest.switch_with_everything_specified(self)
158
+ DocTest.switch_with_everything_omitted(self)
172
159
 
173
160
  desc "command desc"
174
161
  long_desc "command long desc"
175
162
  arg_name "cmd_arg_name"
176
163
  command [:command1,:com1] do |c|
177
- TC_testDoc.flag_with_everything_specified(c)
178
- TC_testDoc.flag_with_everything_omitted(c)
179
- TC_testDoc.switch_with_everything_specified(c)
180
- TC_testDoc.switch_with_everything_omitted(c)
164
+ DocTest.flag_with_everything_specified(c)
165
+ DocTest.flag_with_everything_omitted(c)
166
+ DocTest.switch_with_everything_specified(c)
167
+ DocTest.switch_with_everything_omitted(c)
181
168
 
182
169
  c.desc "subcommand desc"
183
170
  c.long_desc "subcommand long desc"
184
171
  c.arg_name "subcmd_arg_name"
185
172
  c.action { |g,o,a| }
186
173
  c.command [:sub,:subcommand] do |sub|
187
- TC_testDoc.flag_with_everything_specified(sub,:subflag)
188
- TC_testDoc.flag_with_everything_omitted(sub,:subflag2)
189
- TC_testDoc.switch_with_everything_specified(sub,:subswitch)
190
- TC_testDoc.switch_with_everything_omitted(sub,:subswitch2)
174
+ DocTest.flag_with_everything_specified(sub,:subflag)
175
+ DocTest.flag_with_everything_omitted(sub,:subflag2)
176
+ DocTest.switch_with_everything_specified(sub,:subswitch)
177
+ DocTest.switch_with_everything_omitted(sub,:subswitch2)
191
178
  sub.action { |g,o,a| }
192
179
  end
193
180
  c.command [:default] do |sub|
@@ -227,7 +214,7 @@ private
227
214
  def self.switch_with_everything_omitted(on,name=[:S,:switch2])
228
215
  on.switch name
229
216
  end
230
- def the_expected_output
217
+ def construct_expected_output
231
218
  # Oh yeah. Creating a string representing the structure of the calls.
232
219
  @string =<<EOS
233
220
  BEGIN
@@ -1,39 +1,36 @@
1
- require 'test_helper'
1
+ require_relative "test_helper"
2
2
 
3
- class TC_testFlag < Clean::Test::TestCase
3
+ class FlagTest < MiniTest::Test
4
4
  include TestHelper
5
5
 
6
6
  def test_basics_simple
7
- Given flag_with_names(:f)
8
- Then attributes_should_be_set
9
- And name_should_be(:f)
10
- And aliases_should_be(nil)
7
+ setup_for_flag_with_names(:f)
8
+ assert_attributes_set
9
+ assert_equal(:f,@cli_option.name)
10
+ assert_nil @cli_option.aliases
11
11
  end
12
12
 
13
13
  def test_basics_kinda_complex
14
- Given flag_with_names([:f])
15
- Then attributes_should_be_set
16
- And name_should_be(:f)
17
- And aliases_should_be(nil)
14
+ setup_for_flag_with_names([:f])
15
+ assert_attributes_set
16
+ assert_equal(:f,@cli_option.name)
17
+ assert_nil @cli_option.aliases
18
18
  end
19
19
 
20
20
  def test_basics_complex
21
- Given flag_with_names([:f,:file,:filename])
22
- Then attributes_should_be_set
23
- And name_should_be(:f)
24
- And aliases_should_be([:file,:filename])
25
- And {
26
- assert_equal ["-f VAL","--file VAL","--filename VAL",/foobar/,Float],@flag.arguments_for_option_parser
27
- }
21
+ setup_for_flag_with_names([:f,:file,:filename])
22
+ assert_attributes_set
23
+ assert_equal(:f,@cli_option.name)
24
+ assert_equal [:file,:filename], @cli_option.aliases
25
+ assert_equal ["-f VAL","--file VAL","--filename VAL",/foobar/,Float],@flag.arguments_for_option_parser
28
26
  end
29
27
 
30
28
  def test_flag_can_mask_its_value
31
- Given flag_with_names(:password, :mask => true)
32
- Then attributes_should_be_set(:safe_default_value => "********")
29
+ setup_for_flag_with_names(:password, :mask => true)
30
+ assert_attributes_set(:safe_default_value => "********")
33
31
  end
34
32
 
35
- def flag_with_names(names,options = {})
36
- lambda do
33
+ def setup_for_flag_with_names(names,options = {})
37
34
  @options = {
38
35
  :desc => 'Filename',
39
36
  :long_desc => 'The Filename',
@@ -45,11 +42,9 @@ class TC_testFlag < Clean::Test::TestCase
45
42
  }.merge(options)
46
43
  @flag = GLI::Flag.new(names,@options)
47
44
  @cli_option = @flag
48
- end
49
45
  end
50
46
 
51
- def attributes_should_be_set(override={})
52
- lambda {
47
+ def assert_attributes_set(override={})
53
48
  expected = @options.merge(override)
54
49
  assert_equal(expected[:desc],@flag.description)
55
50
  assert_equal(expected[:long_desc],@flag.long_description)
@@ -57,6 +52,5 @@ class TC_testFlag < Clean::Test::TestCase
57
52
  assert_equal(expected[:safe_default_value],@flag.safe_default_value)
58
53
  assert_equal(expected[:must_match],@flag.must_match)
59
54
  assert_equal(expected[:type],@flag.type)
60
- }
61
55
  end
62
56
  end
@@ -1,18 +1,7 @@
1
- # 1.9 adds realpath to resolve symlinks; 1.8 doesn't
2
- # have this method, so we add it so we get resolved symlinks
3
- # and compatibility
4
- unless File.respond_to? :realpath
5
- class File
6
- def self.realpath path
7
- return realpath(File.readlink(path)) if symlink?(path)
8
- path
9
- end
10
- end
11
- end
1
+ require_relative "test_helper"
2
+ require_relative "support/fake_std_out"
12
3
 
13
- require 'test_helper'
14
-
15
- class TC_testGLI < Clean::Test::TestCase
4
+ class GLITest < MiniTest::Test
16
5
  include TestHelper
17
6
 
18
7
  def setup
@@ -24,7 +13,7 @@ class TC_testGLI < Clean::Test::TestCase
24
13
  $stderr = @fake_stderr
25
14
  @app = CLIApp.new
26
15
 
27
- @config_file = File.expand_path(File.dirname(File.realpath(__FILE__)) + '/new_config.yaml')
16
+ @config_file = File.expand_path(File.dirname(File.realpath(__FILE__)) + '/support/new_config.yml')
28
17
  @gli_debug = ENV['GLI_DEBUG']
29
18
  @app.error_device=@fake_stderr
30
19
  ENV.delete('GLI_DEBUG')
@@ -141,7 +130,7 @@ class TC_testGLI < Clean::Test::TestCase
141
130
  def test_init_from_config
142
131
  failure = nil
143
132
  @app.reset
144
- @app.config_file(File.expand_path(File.dirname(File.realpath(__FILE__)) + '/config.yaml'))
133
+ @app.config_file(File.expand_path(File.dirname(File.realpath(__FILE__)) + '/support/gli_test_config.yml'))
145
134
  @app.flag :f
146
135
  @app.switch :s
147
136
  @app.flag :g
@@ -175,7 +164,7 @@ class TC_testGLI < Clean::Test::TestCase
175
164
  def test_command_line_overrides_config
176
165
  failure = nil
177
166
  @app.reset
178
- @app.config_file(File.expand_path(File.dirname(File.realpath(__FILE__)) + '/config.yaml'))
167
+ @app.config_file(File.expand_path(File.dirname(File.realpath(__FILE__)) + '/support/gli_test_config.yml'))
179
168
  @app.flag :f
180
169
  @app.switch :s
181
170
  @app.flag :g
@@ -207,7 +196,7 @@ class TC_testGLI < Clean::Test::TestCase
207
196
  end
208
197
 
209
198
  def test_no_overwrite_config
210
- config_file = File.expand_path(File.dirname(File.realpath(__FILE__)) + '/config.yaml')
199
+ config_file = File.expand_path(File.dirname(File.realpath(__FILE__)) + '/support/gli_test_config.yml')
211
200
  config_file_contents = File.read(config_file)
212
201
  @app.reset
213
202
  @app.config_file(config_file)
@@ -680,7 +669,11 @@ class TC_testGLI < Clean::Test::TestCase
680
669
  end
681
670
  end
682
671
 
683
- assert_nothing_raised(GLI::CustomExit) { @app.run(['multiply', '--help']) }
672
+ begin
673
+ @app.run(['multiply', '--help'])
674
+ rescue GLI::CustomExit
675
+ assert false, "Expected no exception"
676
+ end
684
677
  end
685
678
 
686
679
  class ConvertMe
@@ -810,38 +803,26 @@ class TC_testGLI < Clean::Test::TestCase
810
803
  do_test_switch_create_compact(object)
811
804
  end
812
805
 
813
- def some_descriptions
814
- lambda {
815
- @description = 'this is a description'
816
- @long_description = 'this is a very long description'
817
- }
818
- end
819
-
820
- def assert_switch_was_made(object,switch)
821
- lambda {
822
- assert object.switches[switch]
823
- assert_equal @description,object.switches[switch].description,"For switch #{switch}"
824
- assert_equal @long_description,object.switches[switch].long_description,"For switch #{switch}"
825
- assert(object.usage != nil) if object.respond_to? :usage
826
- }
827
- end
828
-
829
806
  def do_test_switch_create_classic(object)
830
- Given some_descriptions
831
- When {
832
- object.desc @description
833
- object.long_desc @long_description
834
- object.switch :f
835
- }
836
- Then assert_switch_was_made(object,:f)
807
+ @description = 'this is a description'
808
+ @long_description = 'this is a very long description'
809
+ object.desc @description
810
+ object.long_desc @long_description
811
+ object.switch :f
812
+ assert object.switches[:f]
813
+ assert_equal @description,object.switches[:f].description,"For switch #{:f}"
814
+ assert_equal @long_description,object.switches[:f].long_description,"For switch #{:f}"
815
+ assert(object.usage != nil) if object.respond_to? :usage
837
816
  end
838
817
 
839
818
  def do_test_switch_create_compact(object)
840
- Given some_descriptions
841
- When {
842
- object.switch :g, :desc => @description, :long_desc => @long_description
843
- }
844
- Then assert_switch_was_made(object,:g)
819
+ @description = 'this is a description'
820
+ @long_description = 'this is a very long description'
821
+ object.switch :g, :desc => @description, :long_desc => @long_description
822
+ assert object.switches[:g]
823
+ assert_equal @description,object.switches[:g].description,"For switch #{:g}"
824
+ assert_equal @long_description,object.switches[:g].long_description,"For switch #{:g}"
825
+ assert(object.usage != nil) if object.respond_to? :usage
845
826
  end
846
827
 
847
828
  def do_test_switch_create_twice(object)