gemma 4.1.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'bundler/setup'
3
5
  require 'gemma'
4
6
 
5
7
  Gemma::RakeTasks.with_gemspec_file '<%= gem_name %>.gemspec'
6
8
 
7
- task :default => :test
9
+ task default: :test
@@ -1,29 +1,27 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib/', __FILE__)
3
- $:.unshift lib unless $:.include?(lib)
4
-
5
- require '<%= gem_name %>/version'
6
-
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/<%= gem_name %>/version'
4
+
7
5
  Gem::Specification.new do |s|
8
- s.name = '<%= gem_name %>'
9
- s.version = <%= module_name %>::VERSION
10
- s.platform = Gem::Platform::RUBY
11
- s.authors = ['TODO write your name']
12
- s.email = ['TODO write your e-mail address']
13
- s.homepage = 'TODO homepage'
14
- s.summary = %q{TODO write short gem summary}
15
- s.description = %q{TODO write longer gem description}
6
+ s.name = '<%= gem_name %>'
7
+ s.version = <%= module_name %>::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['TODO write your name']
10
+ s.email = ['TODO write your e-mail address']
11
+ s.homepage = 'TODO homepage'
12
+ s.summary = %(TODO write short gem summary)
13
+ s.description = %(TODO write longer gem description)
16
14
 
17
- #s.add_runtime_dependency '...', '~> x.y.z'
15
+ # s.add_runtime_dependency '...', '~> x.y.z'
18
16
  s.add_development_dependency 'gemma', '~> <%= Gemma::VERSION %>'
19
17
 
20
- s.files = Dir.glob('{lib,bin}/**/*.rb') + %w(README.rdoc)
18
+ s.files = Dir.glob('{lib,bin}/**/*.rb') + %w(README.md)
21
19
  s.test_files = Dir.glob('test/<%= gem_name %>/*_test.rb')
22
- s.executables = Dir.glob('bin/*').map{|f| File.basename(f)}
20
+ s.executables = Dir.glob('bin/*').map { |f| File.basename(f) }
23
21
 
24
22
  s.rdoc_options = [
25
- "--main", "README.rdoc",
26
- "--title", "#{s.full_name} Documentation"]
27
- s.extra_rdoc_files << "README.rdoc"
23
+ '--main', 'README.md',
24
+ '--title', "#{s.full_name} Documentation"
25
+ ]
26
+ s.extra_rdoc_files << 'README.md'
28
27
  end
29
-
@@ -1,5 +1,10 @@
1
- require '<%= gem_name %>/version'
1
+ # frozen_string_literal: true
2
2
 
3
+ require_relative '<%= gem_name %>/version'
4
+
5
+ #
6
+ # TODO: write documentation for main class / module
7
+ #
3
8
  module <%= module_name %>
4
- # TODO write code
9
+ # TODO: write code
5
10
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module <%= module_name %>
2
4
  VERSION_MAJOR = 0
3
5
  VERSION_MINOR = 0
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env <%= RbConfig::CONFIG['ruby_install_name'] %>
2
+ # frozen_string_literal: true
2
3
 
3
4
  require '<%= gem_name %>'
4
5
 
5
- abort "TODO write program code"
6
-
6
+ abort 'TODO write program code'
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require '<%= gem_name %>'
2
4
  require 'minitest/autorun'
3
5
 
4
6
  class Test<%= module_name %> < MiniTest::Test
5
7
  def test_<%= gem_name %>
6
- assert_equal 3, 1 + 1, "TODO write tests"
8
+ assert_equal 3, 1 + 1, 'TODO write tests'
7
9
  end
8
10
  end
9
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gemma/test_helper'
2
3
  require 'tmpdir'
3
4
 
@@ -18,29 +19,30 @@ class Gemma::GemFromTemplateTest < MiniTest::Test
18
19
  # basic create-from-template tests
19
20
  #
20
21
  gt = Gemma::GemFromTemplate.new
21
- gt.gem_name = "my_new_gem"
22
+ gt.gem_name = 'my_new_gem'
22
23
  assert gt.good_gem_name?
23
24
 
24
- assert_equal "MyNewGem", gt.module_name
25
- gt.module_name = "Foo" # override default
26
- assert_equal "Foo", gt.module_name
25
+ assert_equal 'MyNewGem', gt.module_name
26
+ gt.module_name = 'Foo' # override default
27
+ assert_equal 'Foo', gt.module_name
27
28
  gt.module_name = nil # revert back to default
28
- assert_equal "MyNewGem", gt.module_name
29
+ assert_equal 'MyNewGem', gt.module_name
29
30
 
30
- assert_equal "my_new_gem", gt.dir_name
31
- gt.dir_name = "bar" # override default
32
- assert_equal "bar", gt.dir_name
31
+ assert_equal 'my_new_gem', gt.dir_name
32
+ gt.dir_name = 'bar' # override default
33
+ assert_equal 'bar', gt.dir_name
33
34
  gt.dir_name = nil # revert back to default
34
- assert_equal "my_new_gem", gt.dir_name
35
+ assert_equal 'my_new_gem', gt.dir_name
35
36
 
36
- template_paths = Gemma::GemFromTemplate::BUILTIN_TEMPLATES.map{|path|
37
- File.join(Gemma::GemFromTemplate::TEMPLATE_ROOT,path)}
37
+ template_paths = Gemma::GemFromTemplate::BUILTIN_TEMPLATES.map do |path|
38
+ File.join(Gemma::GemFromTemplate::TEMPLATE_ROOT, path)
39
+ end
38
40
  assert_equal 'base', File.basename(template_paths.first)
39
41
 
40
- gt.dir_name = "my_new_gem_base"
42
+ gt.dir_name = 'my_new_gem_base'
41
43
  gt.create_gem template_paths[0..0] # just base
42
44
 
43
- gt.dir_name = "my_new_gem_full"
45
+ gt.dir_name = 'my_new_gem_full'
44
46
  gt.create_gem template_paths # expand all templates
45
47
  end
46
48
 
@@ -49,16 +51,16 @@ class Gemma::GemFromTemplateTest < MiniTest::Test
49
51
  # we should be able to find the to-do markers in a newly created gem
50
52
  #
51
53
  gt = Gemma::GemFromTemplate.new
52
- gt.gem_name = "test_gem"
54
+ gt.gem_name = 'test_gem'
53
55
 
54
- template_paths = Gemma::GemFromTemplate::BUILTIN_TEMPLATES.map{|path|
55
- File.join(Gemma::GemFromTemplate::TEMPLATE_ROOT,path)}
56
+ template_paths = Gemma::GemFromTemplate::BUILTIN_TEMPLATES.map do |path|
57
+ File.join(Gemma::GemFromTemplate::TEMPLATE_ROOT, path)
58
+ end
56
59
  gt.create_gem template_paths
57
60
 
58
61
  # look for some to-do markers
59
62
  io = StringIO.new
60
63
  Gemma::Utility.rgrep(/TODO/, gt.destination_path, io)
61
- assert io.string =~ /README\.rdoc/
64
+ assert io.string =~ /README\.md/
62
65
  end
63
66
  end
64
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gemma/test_helper'
2
3
  require 'tmpdir'
3
4
  require 'open4'
@@ -20,13 +21,9 @@ class Gemma::GemmaNewTest < MiniTest::Test
20
21
  # stdout and stderr using Open4. (On 1.9.2, we can use <tt>Open3.popen2e</tt>,
21
22
  # which is nicer, but Open3 on ruby 1.8.7 doesn't let us get exitstatus.)
22
23
  #
23
- def run_cmd *args
24
- Bundler.with_clean_env {
25
- # FIXME in bundler 1.1, this should not be necessary; see
26
- # https://github.com/carlhuda/bundler/issues/1133
27
- ENV.delete_if { |k,_| k[0,7] == 'BUNDLE_' }
28
-
29
- # We also have to clear RUBYOPT, because Bundler::ORIGINAL_ENV in the test
24
+ def run_cmd(*args)
25
+ Bundler.with_clean_env do
26
+ # We have to clear RUBYOPT, because Bundler::ORIGINAL_ENV in the test
30
27
  # runner's process still contains some bundler stuff from rake's process.
31
28
  # This suggests that we might have to stop using rake's built-in TestTask,
32
29
  # and instead use one that runs the tests in a Bundler.with_clean_env
@@ -35,12 +32,12 @@ class Gemma::GemmaNewTest < MiniTest::Test
35
32
  ENV.delete('RUBYOPT')
36
33
 
37
34
  output = nil
38
- status = Open4.popen4(*args) {|pid,i,o,e|
35
+ status = Open4.popen4(*args) do |_pid, i, o, e|
39
36
  i.close
40
37
  output = o.read + e.read
41
- }
38
+ end
42
39
  [status, output]
43
- }
40
+ end
44
41
  end
45
42
 
46
43
  def setup
@@ -52,32 +49,39 @@ class Gemma::GemmaNewTest < MiniTest::Test
52
49
  # create a test gem; note that here we DO want the gemma bundler
53
50
  # environment, because it puts our gemma executable on the bin path
54
51
  output = `gemma new --name="test_gem"`
55
- raise "gemma new failed:\n#{output}" unless $?.exitstatus
52
+ raise "gemma new failed:\n#{output}" unless $CHILD_STATUS.exitstatus
56
53
 
57
54
  # we should get some TODOs from the template in the output
58
- assert_match /TODO write your name/, output
55
+ assert_match(/TODO write your name/, output)
59
56
 
60
57
  Dir.chdir('test_gem')
61
58
 
62
59
  # edit the test gem's Gemfile to point to this gemma
63
- raise "no Gemfile in test gem" unless File.exists?('Gemfile')
60
+ raise 'no Gemfile in test gem' unless File.exist?('Gemfile')
64
61
  File.open('Gemfile', 'a') do |f|
65
62
  f.puts "gem 'gemma', :path => #{@old_pwd.dump}"
66
63
  end
67
64
 
65
+ # bundler will complain if we don't fill in the TODOs
66
+ gemspec_name = 'test_gem.gemspec'
67
+ gemspec = File.read(gemspec_name)
68
+ gemspec.gsub!(/TODO\s*/, '')
69
+ gemspec.gsub!(/'homepage'/, "'http://example.com'")
70
+ File.open(gemspec_name, 'w') { |f| f.puts gemspec }
71
+
68
72
  # run bundler on the test gem; it should find the same gems that we're using
69
73
  # in the gemma bundle
70
74
  status, output = run_cmd('bundle', 'install', '--local')
71
- raise "bundle failed:\n#{output}" unless status.exitstatus == 0
75
+ raise "bundle failed:\n#{output}" unless status.exitstatus.zero?
72
76
 
73
77
  # it should say that it has loaded two things from source: gemma and the
74
78
  # test_gem itself; if it doesn't it indicates that something strange
75
79
  # happened with bundler's environment (or it may just break on future
76
80
  # versions of bundler)
77
- raise "did not load from source" unless output =~ /from source at/
81
+ raise 'did not load from source' unless output =~ /from source at/
78
82
 
79
83
  # bundler should produce a lock file
80
- raise "no Gemfile.lock in test gem" unless File.exists?('Gemfile.lock')
84
+ raise 'no Gemfile.lock in test gem' unless File.exist?('Gemfile.lock')
81
85
  end
82
86
 
83
87
  def teardown
@@ -89,27 +93,25 @@ class Gemma::GemmaNewTest < MiniTest::Test
89
93
  # list the rake tasks; this ensures that gemma loaded
90
94
  status, output = run_cmd('rake -T')
91
95
  assert_equal 0, status.exitstatus
92
- assert_match /rake test/, output
93
- assert_match /rake rdoc/, output
94
- assert_match /rake yard/, output
96
+ assert_match(/rake test/, output)
97
+ assert_match(/rake rdoc/, output)
98
+ assert_match(/rake yard/, output)
95
99
 
96
100
  # run the tests; they should fail initially
97
101
  status, output = run_cmd('rake')
98
- assert status.exitstatus != 0
99
- assert_match /TODO write tests/, output
102
+ assert status.exitstatus.nonzero?
103
+ assert_match(/TODO write tests/, output)
100
104
 
101
105
  # generate rdoc output
102
- status, output = run_cmd('rake rdoc')
106
+ status, _output = run_cmd('rake rdoc')
103
107
  assert_equal 0, status.exitstatus
104
108
 
105
109
  # generate yard output
106
- status, output = run_cmd('rake yard')
110
+ status, _output = run_cmd('rake yard')
107
111
  assert_equal 0, status.exitstatus
108
112
 
109
- # build the gem; this should fail, because we have invalid authors, etc.
110
- status, output = run_cmd('rake build')
111
- assert_match /TODO/, output # "... is not a valid author"
112
- assert_equal 1, status.exitstatus
113
+ # build the gem
114
+ status, _output = run_cmd('rake build')
115
+ assert_equal 0, status.exitstatus
113
116
  end
114
117
  end
115
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gemma/test_helper'
2
3
  require 'set'
3
4
 
@@ -19,7 +20,7 @@ class Gemma::GemmaTest < MiniTest::Test
19
20
  assert_equal %w(lib FAQ README.md).to_set, g.rdoc.files.to_set
20
21
  assert_equal [], g.rdoc.options
21
22
  assert_equal 'README.md', g.rdoc.main
22
- assert_equal nil, g.rdoc.title
23
+ assert_nil g.rdoc.title
23
24
 
24
25
  g.rdoc.with_rdoc_task do |rd|
25
26
  assert_equal rd.rdoc_files, g.rdoc.files
@@ -44,14 +45,16 @@ class Gemma::GemmaTest < MiniTest::Test
44
45
  assert_equal [], g.yard.options
45
46
  assert_equal 'yard', g.yard.output
46
47
  assert_equal :yard, g.yard.task_name
47
- assert_equal nil, g.yard.title
48
+ assert_nil g.yard.title
48
49
 
49
50
  g.yard.with_yardoc_task do |yd|
50
51
  assert_equal %w(lib), yd.files
51
52
  assert_equal 4, yd.options.size
52
- assert_equal 'README.rdoc',
53
+ assert_equal \
54
+ 'README.rdoc',
53
55
  Gemma::Options.extract(%w(--main), yd.options).argument
54
- assert_equal 'yard',
56
+ assert_equal \
57
+ 'yard',
55
58
  Gemma::Options.extract(%w(--output), yd.options).argument
56
59
  end
57
60
  end
@@ -83,8 +86,10 @@ class Gemma::GemmaTest < MiniTest::Test
83
86
 
84
87
  # Some more complicated options.
85
88
  # Note that we ignore things that could be files ('bat').
86
- s.rdoc_options = ['foo bar', '--baz', 'bat', '--title', 'a b c',
87
- '--diagram', '--main', 'README.rdoc', 'ABCD']
89
+ s.rdoc_options = [
90
+ 'foo bar', '--baz', 'bat', '--title', 'a b c', '--diagram', '--main',
91
+ 'README.rdoc', 'ABCD'
92
+ ]
88
93
  Gemma::RakeTasks.new(s) do |g|
89
94
  assert_equal 'a b c', g.yard.title
90
95
  assert_equal [], g.yard.options
@@ -92,11 +97,14 @@ class Gemma::GemmaTest < MiniTest::Test
92
97
  g.yard.with_yardoc_task do |yd|
93
98
  assert_equal %w(lib - FAQ), yd.files
94
99
  assert_equal 6, yd.options.size
95
- assert_equal 'README.rdoc',
100
+ assert_equal \
101
+ 'README.rdoc',
96
102
  Gemma::Options.extract(%w(--main), yd.options).argument
97
- assert_equal 'yard',
103
+ assert_equal \
104
+ 'yard',
98
105
  Gemma::Options.extract(%w(--output), yd.options).argument
99
- assert_equal 'a b c',
106
+ assert_equal \
107
+ 'a b c',
100
108
  Gemma::Options.extract(%w(--title), yd.options).argument
101
109
  end
102
110
  end
@@ -115,33 +123,37 @@ class Gemma::GemmaTest < MiniTest::Test
115
123
  Gemma::RakeTasks.new(s) do |g|
116
124
  g.test.with_test_task do |tt|
117
125
  assert_equal %w(lib foo test).to_set, tt.libs.to_set
118
- assert_equal %w(test/test_a.rb test/test_b.rb).to_set,
126
+ assert_equal \
127
+ %w(test/test_a.rb test/test_b.rb).to_set,
119
128
  tt.file_list.to_a.to_set
120
129
  end
121
130
  end
122
131
  end
123
132
 
124
133
  def test_conventions_good_gem_name
125
- assert Gemma::Conventions.good_gem_name?("my_gem_name")
126
- assert Gemma::Conventions.good_gem_name?("my-gem-name")
127
- assert Gemma::Conventions.good_gem_name?("foo")
128
- assert Gemma::Conventions.good_gem_name?("foo1")
129
- assert Gemma::Conventions.good_gem_name?("foo_4_bar")
130
- assert !Gemma::Conventions.good_gem_name?("Foo")
131
- assert !Gemma::Conventions.good_gem_name?("FooBar")
132
- assert !Gemma::Conventions.good_gem_name?("Foo_Bar")
133
- assert !Gemma::Conventions.good_gem_name?("Foo-Bar")
134
+ assert Gemma::Conventions.good_gem_name?('my_gem_name')
135
+ assert Gemma::Conventions.good_gem_name?('my-gem-name')
136
+ assert Gemma::Conventions.good_gem_name?('foo')
137
+ assert Gemma::Conventions.good_gem_name?('foo1')
138
+ assert Gemma::Conventions.good_gem_name?('foo_4_bar')
139
+ assert !Gemma::Conventions.good_gem_name?('Foo')
140
+ assert !Gemma::Conventions.good_gem_name?('FooBar')
141
+ assert !Gemma::Conventions.good_gem_name?('Foo_Bar')
142
+ assert !Gemma::Conventions.good_gem_name?('Foo-Bar')
134
143
  end
135
144
 
136
145
  def test_conventions_gem_name_to_module_name
137
- assert_equal 'MyGem',
138
- Gemma::Conventions.gem_name_to_module_name("my_gem")
139
- assert_equal 'MyGem3',
140
- Gemma::Conventions.gem_name_to_module_name("my_gem3")
141
- assert_equal 'A4B',
142
- Gemma::Conventions.gem_name_to_module_name("a_4_b")
143
- assert_equal 'A4b',
144
- Gemma::Conventions.gem_name_to_module_name("a4b")
146
+ assert_equal \
147
+ 'MyGem', Gemma::Conventions.gem_name_to_module_name('my_gem')
148
+ assert_equal \
149
+ 'MyGem3',
150
+ Gemma::Conventions.gem_name_to_module_name('my_gem3')
151
+ assert_equal \
152
+ 'A4B',
153
+ Gemma::Conventions.gem_name_to_module_name('a_4_b')
154
+ assert_equal \
155
+ 'A4b',
156
+ Gemma::Conventions.gem_name_to_module_name('a4b')
145
157
  end
146
158
 
147
159
  #
@@ -157,9 +169,8 @@ class Gemma::GemmaTest < MiniTest::Test
157
169
  def test_plugin_abstract
158
170
  s = Gem::Specification.new
159
171
  plugin = Gemma::RakeTasks::Plugin.new(s)
160
- assert_raises(NotImplementedError) {
172
+ assert_raises(NotImplementedError) do
161
173
  plugin.create_rake_tasks # abstract method
162
- }
174
+ end
163
175
  end
164
176
  end
165
-
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gemma/test_helper'
2
3
 
3
4
  class OptionsTest < MiniTest::Test
@@ -5,7 +6,8 @@ class OptionsTest < MiniTest::Test
5
6
 
6
7
  def test_empty
7
8
  # empty input
8
- assert_equal Options::ExtractResult.new(nil, []),
9
+ assert_equal \
10
+ Options::ExtractResult.new(nil, []),
9
11
  Options.extract(%w(--a), [])
10
12
  end
11
13
 
@@ -13,87 +15,108 @@ class OptionsTest < MiniTest::Test
13
15
  input = %w(--a av --b --c=cv)
14
16
 
15
17
  # option a has an argument
16
- assert_equal Options::ExtractResult.new('av', %w(--b --c=cv)),
18
+ assert_equal \
19
+ Options::ExtractResult.new('av', %w(--b --c=cv)),
17
20
  Options.extract(%w(--a), input)
18
21
 
19
22
  # option b has no argument; result is ''
20
- assert_equal Options::ExtractResult.new('', %w(--a av --c=cv)),
23
+ assert_equal \
24
+ Options::ExtractResult.new('', %w(--a av --c=cv)),
21
25
  Options.extract(%w(--b), input)
22
26
 
23
27
  # option c also has argument
24
- assert_equal Options::ExtractResult.new('cv', %w(--a av --b)),
28
+ assert_equal \
29
+ Options::ExtractResult.new('cv', %w(--a av --b)),
25
30
  Options.extract(%w(--c), input)
26
31
 
27
32
  # there is no option d; result is nil
28
- assert_equal Options::ExtractResult.new(nil, input),
33
+ assert_equal \
34
+ Options::ExtractResult.new(nil, input),
29
35
  Options.extract(%w(--d), input)
30
36
  end
31
37
 
32
38
  def test_terminator
33
39
  # just the -- terminator
34
- assert_equal Options::ExtractResult.new(nil, ['--']),
40
+ assert_equal \
41
+ Options::ExtractResult.new(nil, ['--']),
35
42
  Options.extract(%w(--a), ['--'])
36
43
 
37
44
  # should keep content before and after the -- terminator
38
- assert_equal Options::ExtractResult.new(nil, %w(a -- b)),
45
+ assert_equal \
46
+ Options::ExtractResult.new(nil, %w(a -- b)),
39
47
  Options.extract(%w(--a), %w(a -- b))
40
48
  end
41
49
 
42
50
  def test_terminator_2
43
- input = %w(foo --a av -- --b bv)
51
+ input = %w(foo --a av -- --b bv)
44
52
 
45
53
  # should not be able to find options after the -- terminator
46
- assert_equal Options::ExtractResult.new('av', %w(foo -- --b bv)),
54
+ assert_equal \
55
+ Options::ExtractResult.new('av', %w(foo -- --b bv)),
47
56
  Options.extract(%w(--a), input)
48
- assert_equal Options::ExtractResult.new(nil, input),
57
+ assert_equal \
58
+ Options::ExtractResult.new(nil, input),
49
59
  Options.extract(%w(--b), input)
50
- assert_equal Options::ExtractResult.new('', %w(-- --b)),
60
+ assert_equal \
61
+ Options::ExtractResult.new('', %w(-- --b)),
51
62
  Options.extract(%w(--a), %w(--a -- --b))
52
- assert_equal Options::ExtractResult.new(nil, %w(--a -- --b)),
63
+ assert_equal \
64
+ Options::ExtractResult.new(nil, %w(--a -- --b)),
53
65
  Options.extract(%w(--b), %w(--a -- --b))
54
66
  end
55
67
 
56
68
  def test_short_form
57
69
  # should be able to find -a but not -b
58
- input = %w(foo -a av -- -b bv)
59
- assert_equal Options::ExtractResult.new('av', %w(foo -- -b bv)),
70
+ input = %w(foo -a av -- -b bv)
71
+ assert_equal \
72
+ Options::ExtractResult.new('av', %w(foo -- -b bv)),
60
73
  Options.extract(%w(-a), input)
61
- assert_equal Options::ExtractResult.new(nil, input),
74
+ assert_equal \
75
+ Options::ExtractResult.new(nil, input),
62
76
  Options.extract(%w(-b), input)
63
77
 
64
78
  # the -aav and -b bv forms
65
79
  input = %w(-aav -b bv)
66
- assert_equal Options::ExtractResult.new('av', %w(-b bv)),
80
+ assert_equal \
81
+ Options::ExtractResult.new('av', %w(-b bv)),
67
82
  Options.extract(%w(-a), input)
68
- assert_equal Options::ExtractResult.new('bv', %w(-aav)),
83
+ assert_equal \
84
+ Options::ExtractResult.new('bv', %w(-aav)),
69
85
  Options.extract(%w(-b), input)
70
86
 
71
87
  # short form with no argument
72
- assert_equal Options::ExtractResult.new('', %w(-a av)),
88
+ assert_equal \
89
+ Options::ExtractResult.new('', %w(-a av)),
73
90
  Options.extract(%w(-b), %w(-a av -b))
74
91
 
75
92
  # missing short form argument
76
- assert_equal Options::ExtractResult.new(nil, %w(-a av -b foo bar.txt)),
93
+ assert_equal \
94
+ Options::ExtractResult.new(nil, %w(-a av -b foo bar.txt)),
77
95
  Options.extract(%w(-c), %w(-a av -b foo bar.txt))
78
96
  end
79
97
 
80
98
  def test_multiple_options
81
99
  # single -a means we pick up a1
82
- assert_equal Options::ExtractResult.new('a1', []),
100
+ assert_equal \
101
+ Options::ExtractResult.new('a1', []),
83
102
  Options.extract(%w(-a), %w(-a a1))
84
103
 
85
104
  # the second -a means that we pick up a2
86
- assert_equal Options::ExtractResult.new('a2', []),
105
+ assert_equal \
106
+ Options::ExtractResult.new('a2', []),
87
107
  Options.extract(%w(-a), %w(-a a1 -a a2))
88
- assert_equal Options::ExtractResult.new('a2', %w(hi -bfoo)),
108
+ assert_equal \
109
+ Options::ExtractResult.new('a2', %w(hi -bfoo)),
89
110
  Options.extract(%w(-a), %w(hi -a a1 -a a2 -bfoo))
90
111
 
91
112
  # mixing long and short forms doesn't affect this
92
- assert_equal Options::ExtractResult.new('a2', []),
113
+ assert_equal \
114
+ Options::ExtractResult.new('a2', []),
93
115
  Options.extract(%w(-a --a), %w(-a a1 --a a2))
94
116
 
95
117
  # a duplicate option after the -- terminator makes no difference
96
- assert_equal Options::ExtractResult.new('a1', %w(-- -aa2)),
118
+ assert_equal \
119
+ Options::ExtractResult.new('a1', %w(-- -aa2)),
97
120
  Options.extract(%w(-a), %w(-a a1 -- -aa2))
98
121
  end
99
122
  end