verbs 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The program conjugates most common english verbs with the following option:
2
4
  # * :tense => :past or :present or :future (default: :present)
3
5
  # * :person => :first or :second or :third (default: :third)
@@ -24,7 +26,9 @@ module Verbs
24
26
 
25
27
  # Creates initial variables for class
26
28
  def initialize
27
- @irregulars, @single_terminal_consonants, @copulars = {}, [], {}
29
+ @irregulars = {}
30
+ @single_terminal_consonants = []
31
+ @copulars = {}
28
32
  end
29
33
 
30
34
  # Determines irregular verbs from the expression
@@ -38,9 +42,13 @@ module Verbs
38
42
  # create new Verb object with infinitive and &blk
39
43
  irregular = ::Verbs::Verb.new infinitive, &blk
40
44
  else
41
- raise ArgumentError, "Standard irregular verbs must specify preterite and past participle forms" unless preterite and past_participle
45
+ unless preterite && past_participle
46
+ raise ArgumentError,
47
+ 'Standard irregular verbs must specify preterite and past participle forms'
48
+ end
49
+
42
50
  # create new Verb object with infinitive, preterite and past_participle
43
- irregular = ::Verbs::Verb.new infinitive, :preterite => preterite, :past_participle => past_participle
51
+ irregular = ::Verbs::Verb.new infinitive, preterite: preterite, past_participle: past_participle
44
52
  end
45
53
  @irregulars[infinitive] = irregular
46
54
  end
@@ -99,15 +107,15 @@ module Verbs
99
107
  # * options, list of options given to determine conjugation
100
108
  def subject(options)
101
109
  case [options[:person], options[:plurality]]
102
- when [:first, :singular]
110
+ when %i[first singular]
103
111
  'I'
104
- when [:first, :plural]
112
+ when %i[first plural]
105
113
  'we'
106
- when [:second, :singular], [:second, :plural]
114
+ when %i[second singular], %i[second plural]
107
115
  'you'
108
- when [:third, :singular]
116
+ when %i[third singular]
109
117
  'he'
110
- when [:third, :plural]
118
+ when %i[third plural]
111
119
  'they'
112
120
  end
113
121
  end
@@ -143,13 +151,13 @@ module Verbs
143
151
  # * plurality, an option given by the user
144
152
  # * mood, an option given by the user
145
153
  def inflect(infinitive, inflection, person, plurality, mood)
146
- send(*([inflection, infinitive, person, plurality, mood][0, method(inflection).arity + 1]))
154
+ send(*[inflection, infinitive, person, plurality, mood][0, method(inflection).arity + 1])
147
155
  end
148
156
 
149
157
  def present(infinitive, person, plurality, mood)
150
- if verb = conjugations.irregulars[infinitive]
151
- conjugate_irregular(verb, :tense => :present, :person => person, :plurality => plurality, :mood => mood)
152
- elsif person == :third and plurality == :singular and not mood == :subjunctive
158
+ if (verb = conjugations.irregulars[infinitive])
159
+ conjugate_irregular(verb, tense: :present, person: person, plurality: plurality, mood: mood)
160
+ elsif (person == :third) && (plurality == :singular) && (mood != :subjunctive)
153
161
  present_third_person_singular_form_for infinitive
154
162
  else
155
163
  infinitive
@@ -163,8 +171,8 @@ module Verbs
163
171
  # * plurality, an option given by the user
164
172
  # * mood, an option given by the user
165
173
  def past(infinitive, person, plurality, mood)
166
- if verb = conjugations.irregulars[infinitive]
167
- conjugate_irregular(verb, :tense => :past, :person => person, :plurality => plurality, :mood => mood)
174
+ if (verb = conjugations.irregulars[infinitive])
175
+ conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood)
168
176
  else
169
177
  regular_preterite_for infinitive
170
178
  end
@@ -174,36 +182,40 @@ module Verbs
174
182
  # Params:
175
183
  # * infinitive, the given verb
176
184
  def present_participle(infinitive)
177
- if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANT_PATTERN}$/) and !conjugations.single_terminal_consonants.include?(infinitive.to_sym)
178
- present_participle_with_doubled_terminal_consonant_for infinitive
179
- elsif infinitive.to_s.match(/c$/)
180
- infinitive.to_s.concat('king').to_sym
181
- elsif infinitive.to_s.match(/^be$/) or infinitive.to_s.match(/ye$/) or infinitive.to_s.match(/oe$/) or infinitive.to_s.match(/nge$/) or infinitive.to_s.match(/ee$/)
182
- infinitive.to_s.concat('ing').to_sym
183
- elsif infinitive.to_s.match(/ie$/)
184
- infinitive.to_s[0..-2].concat('ying').to_sym
185
- elsif infinitive.to_s.match(/e$/)
186
- infinitive.to_s[0..-2].concat('ing').to_sym
187
- else
188
- infinitive.to_s[0..-1].concat('ing').to_sym
185
+ if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANTS_WITHOUT_C_PATTERN}$/) &&
186
+ !conjugations.single_terminal_consonants.include?(infinitive.to_sym)
187
+ return present_participle_with_doubled_terminal_consonant_for infinitive
189
188
  end
189
+
190
+ case infinitive.to_s
191
+ when /c$/
192
+ "#{infinitive}k"
193
+ when /(^be|ye|oe|nge|ee)$/
194
+ infinitive.to_s
195
+ when /ie$/
196
+ infinitive.to_s.gsub(/ie$/, 'y')
197
+ when /#{VOWEL_PATTERN}#{CONSONANT_PATTERN}e$/, /ue$/
198
+ infinitive.to_s[0..-2]
199
+ else # rubocop:disable Lint/DuplicateBranch
200
+ infinitive.to_s
201
+ end.dup.concat('ing').to_sym
190
202
  end
191
203
 
192
204
  # Forming verb to apply past tense endings
193
205
  # Params:
194
206
  # * infinitive, the given verb
195
207
  def past_participle(infinitive)
196
- if verb = conjugations.irregulars[infinitive]
197
- conjugate_irregular(verb, :tense => :past, :derivative => :participle)
208
+ if (verb = conjugations.irregulars[infinitive])
209
+ conjugate_irregular(verb, tense: :past, derivative: :participle)
198
210
  else
199
211
  regular_preterite_for infinitive
200
212
  end
201
213
  end
202
214
 
203
- #
215
+ #
204
216
  # Params:
205
- # * verb,
206
- # * options,
217
+ # * verb,
218
+ # * options,
207
219
  def conjugate_irregular(verb, options)
208
220
  return verb[options] if verb[options]
209
221
 
@@ -212,9 +224,9 @@ module Verbs
212
224
  plurality = options[:plurality]
213
225
  derivative = options[:derivative]
214
226
 
215
- if [tense, person, plurality] == [:present, :third, :singular]
227
+ if [tense, person, plurality] == %i[present third singular]
216
228
  present_third_person_singular_form_for verb
217
- elsif [tense, derivative] == [:past, :participle]
229
+ elsif [tense, derivative] == %i[past participle]
218
230
  verb.past_participle
219
231
  elsif tense == :present
220
232
  verb.infinitive
@@ -229,14 +241,15 @@ module Verbs
229
241
  def present_third_person_singular_form_for(verb)
230
242
  infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s
231
243
 
232
- if infinitive =~ /[a-z&&#{CONSONANT_PATTERN}]y$/i
233
- infinitive[0..-2] + 'ies'
234
- elsif infinitive =~ /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i
235
- infinitive + 'es'
236
- elsif infinitive =~ /[^s]s$/i
237
- infinitive + 'ses'
244
+ case infinitive
245
+ when /[a-z&&#{CONSONANT_PATTERN}]y$/i
246
+ "#{infinitive[0..-2]}ies"
247
+ when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i
248
+ "#{infinitive}es"
249
+ when /[^s]s$/i
250
+ "#{infinitive}ses"
238
251
  else
239
- infinitive + 's'
252
+ "#{infinitive}s"
240
253
  end
241
254
  end
242
255
 
@@ -246,29 +259,39 @@ module Verbs
246
259
  def regular_preterite_for(verb)
247
260
  infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s
248
261
 
249
- if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_PATTERN}$/) and !conjugations.single_terminal_consonants.include?(verb.to_sym)
250
- regular_preterite_with_doubled_terminal_consonant_for verb
251
- elsif verb.to_s.match(/#{CONSONANT_PATTERN}e$/) or verb.to_s.match(/ye$/) or verb.to_s.match(/oe$/) or verb.to_s.match(/nge$/) or verb.to_s.match(/ie$/) or verb.to_s.match(/ee$/)
252
- infinitive.to_s.concat('d').to_sym
253
- elsif verb.to_s.match(/#{CONSONANT_PATTERN}y$/)
254
- infinitive.to_s.chomp('y').concat('ied').to_sym
262
+ if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&
263
+ !conjugations.single_terminal_consonants.include?(verb.to_sym)
264
+ return regular_preterite_with_doubled_terminal_consonant_for verb
265
+ end
266
+
267
+ case verb.to_s
268
+ when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/
269
+ infinitive.concat('d').to_sym
270
+ when /#{CONSONANT_PATTERN}y$/
271
+ infinitive.gsub(/y$/, 'ied').to_sym
272
+ when /c$/
273
+ infinitive.gsub(/c$/, 'cked').to_sym
255
274
  else
256
- infinitive.to_s.concat('ed').to_sym
275
+ infinitive.concat('ed').to_sym
257
276
  end
258
277
  end
259
278
 
260
279
  # Apply proper rules to consonant endings
261
280
  # Params:
262
- # * verb, apply doule consonant to this
281
+ # * verb, apply double consonant to this
263
282
  def regular_preterite_with_doubled_terminal_consonant_for(verb)
264
- regular_preterite_for verb.to_s.concat(verb.to_s[-1,1]).to_sym
283
+ regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym
265
284
  end
266
285
 
267
286
  # Apply proper rules to consonant endings
268
287
  # Params:
269
- # * verb, apply doule consonant to this
288
+ # * verb, apply double consonant to this
270
289
  def present_participle_with_doubled_terminal_consonant_for(verb)
271
- present_participle verb.to_s.concat(verb.to_s[-1,1]).to_sym
290
+ if /c$/ =~ verb.to_s
291
+ present_participle verb.to_sym
292
+ else
293
+ present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym
294
+ end
272
295
  end
273
296
 
274
297
  # Add appropriate aspects to the tense of the conjugation
@@ -278,7 +301,8 @@ module Verbs
278
301
  # * diathesis, an option given by the user
279
302
  def form_for(tense, aspect, diathesis)
280
303
  form = []
281
- if diathesis == :active
304
+ case diathesis
305
+ when :active
282
306
  if tense == :future
283
307
  form << 'will'
284
308
  form << :infinitive if aspect == :habitual
@@ -287,15 +311,15 @@ module Verbs
287
311
  form.concat ['be', :present_participle] if aspect == :progressive
288
312
  form.concat ['be about to', :infinitive] if aspect == :prospective
289
313
  else
290
- form.concat ['used to', :infinitive] if [tense, aspect] == [:past, :habitual]
291
- form.concat [:have, :past_participle] if aspect == :perfect
292
- form << :past if [tense, aspect] == [:past, :perfective]
293
- form.concat [:be, :present_participle] if aspect == :progressive
314
+ form.concat ['used to', :infinitive] if [tense, aspect] == %i[past habitual]
315
+ form.concat %i[have past_participle] if aspect == :perfect
316
+ form << :past if [tense, aspect] == %i[past perfective]
317
+ form.concat %i[be present_participle] if aspect == :progressive
294
318
  form.concat [:be, 'about to', :infinitive] if aspect == :prospective
295
- form << :present if [tense, aspect] == [:present, :habitual]
296
- form.concat [:be, 'having', :past_participle] if [tense, aspect] == [:present, :perfective]
319
+ form << :present if [tense, aspect] == %i[present habitual]
320
+ form.concat [:be, 'having', :past_participle] if [tense, aspect] == %i[present perfective]
297
321
  end
298
- elsif diathesis == :passive
322
+ when :passive
299
323
  if tense == :future
300
324
  form << 'will'
301
325
  form.concat ['be', :past_participle] if aspect == :habitual
@@ -303,12 +327,12 @@ module Verbs
303
327
  form.concat ['be being', :past_participle] if aspect == :progressive
304
328
  form.concat ['be about to be', :past_participle] if aspect == :prospective
305
329
  else
306
- form.concat ['used to be', :past_participle] if [tense, aspect] == [:past, :habitual]
330
+ form.concat ['used to be', :past_participle] if [tense, aspect] == %i[past habitual]
307
331
  form.concat [:have, 'been', :past_participle] if aspect == :perfect
308
- form.concat [:be, :past_participle] if [tense, aspect] == [:past, :perfective]
332
+ form.concat %i[be past_participle] if [tense, aspect] == %i[past perfective]
309
333
  form.concat [:be, 'being', :past_participle] if aspect == :progressive
310
334
  form.concat [:be, 'about to be', :past_participle] if aspect == :prospective
311
- form.concat [:be, :past_participle] if [tense, aspect] == [:present, :habitual]
335
+ form.concat %i[be past_participle] if [tense, aspect] == %i[present habitual]
312
336
  end
313
337
  end
314
338
  form
@@ -321,10 +345,10 @@ module Verbs
321
345
  # * mood, an option given by the user
322
346
  # * diathesis, an option given by the user
323
347
  def check_for_improper_constructions(infinitive, tense, person, mood, diathesis)
324
- if mood == :imperative and not (person == :second and tense == :present)
348
+ if (mood == :imperative) && !((person == :second) && (tense == :present))
325
349
  raise Verbs::ImproperConstruction, 'The imperative mood requires present tense and second person'
326
350
  end
327
- if infinitive.to_sym == :be and diathesis == :passive
351
+ if (infinitive.to_sym == :be) && (diathesis == :passive)
328
352
  raise Verbs::ImproperConstruction, 'There is no passive diathesis for the copula'
329
353
  end
330
354
  end
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Verbs
2
- class ImproperConstruction < ArgumentError;
4
+ class ImproperConstruction < ArgumentError
3
5
  end
4
6
  end
data/lib/verbs/verb.rb CHANGED
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Verbs
2
4
  class Verb
3
5
  attr_reader :infinitive, :preterite, :past_participle
4
-
5
- def initialize(infinitive, options = {}, &blk)
6
+
7
+ def initialize(infinitive, options = {})
6
8
  @infinitive = infinitive
7
9
  @forms = {}
8
10
  if block_given?
@@ -12,29 +14,36 @@ module Verbs
12
14
  @past_participle = options[:past_participle]
13
15
  end
14
16
  end
15
-
17
+
16
18
  def form(word, options = {})
17
- raise ArgumentError, 'Irregular verb specifications must identify tense and must identify either derivative, mood, or person and plurality' unless options[:tense] and (options[:derivative] or options[:mood] or (options[:person] and options[:plurality]))
18
-
19
+ unless options[:tense] && (options[:derivative] || options[:mood] || (options[:person] && options[:plurality]))
20
+ raise ArgumentError,
21
+ 'Irregular verb specifications must identify tense and must identify either derivative, mood, or person and plurality'
22
+ end
23
+
19
24
  tense = options[:tense]
20
25
 
21
26
  @forms[:present] ||= {}
22
27
  @forms[:past] ||= {}
23
- if derivative = options[:derivative]
28
+ if (derivative = options[:derivative])
24
29
  @forms[tense][derivative] = word
25
- elsif mood = options[:mood]
30
+ elsif (mood = options[:mood])
26
31
  @forms[tense][mood] = word
27
- elsif person = options[:person]
32
+ elsif (person = options[:person])
28
33
  @forms[tense][person] ||= {}
29
34
  @forms[tense][person][options[:plurality]] = word
30
35
  end
31
36
  end
32
-
37
+
33
38
  def [](options = {})
34
- tense, person, plurality, derivative, mood = options[:tense], options[:person], options[:plurality], options[:derivative], options[:mood]
35
- if tense and person and plurality and mood
39
+ tense = options[:tense]
40
+ person = options[:person]
41
+ plurality = options[:plurality]
42
+ derivative = options[:derivative]
43
+ mood = options[:mood]
44
+ if tense && person && plurality && mood
36
45
  @forms[tense].try(:[], mood) || @forms[tense].try(:[], person).try(:[], plurality)
37
- elsif tense and derivative
46
+ elsif tense && derivative
38
47
  @forms[tense].try(:[], derivative)
39
48
  end
40
49
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Verbs
2
4
  module Verblike
3
5
  class Wrapper
@@ -6,7 +8,7 @@ module Verbs
6
8
  end
7
9
 
8
10
  def conjugate(options)
9
- words = @base.to_s.split(' ')
11
+ words = @base.to_s.split
10
12
  words.shift if words.first.downcase == 'to'
11
13
  infinitive = words.shift.downcase.to_sym
12
14
  conjugation = ::Verbs::Conjugator.conjugate infinitive, options
data/lib/verbs/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Verbs
2
- VERSION = "3.0.0"
4
+ VERSION = '3.1.0'
3
5
  end
data/lib/verbs.rb CHANGED
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'singleton'
4
+ require 'time'
2
5
  require 'active_support'
3
6
  require 'active_support/core_ext'
4
7
  require 'verbs/verb'
@@ -8,10 +11,14 @@ require 'verbs/verblike'
8
11
  require 'verbs/improper_construction'
9
12
 
10
13
  module Verbs
11
- CONSONANTS = %w(b c d f g h j k l m n p q r s t v w x z)
14
+ CONSONANTS = %w[b c d f g h j k l m n p q r s t v w x z].freeze
12
15
  CONSONANT_PATTERN = "[#{CONSONANTS.join}]"
13
- DOUBLED_CONSONANTS = %w(b c d f g h j k l m n p q r s t z)
16
+ CONSONANTS_WITHOUT_C = (CONSONANTS - ['c']).freeze
17
+ CONSONANTS_WITHOUT_C_PATTERN = "[#{CONSONANTS_WITHOUT_C.join}]"
18
+ DOUBLED_CONSONANTS = (CONSONANTS - %w[v w x]).freeze
14
19
  DOUBLED_CONSONANT_PATTERN = "[#{DOUBLED_CONSONANTS.join}]"
15
- VOWELS = %w(a e i o u y)
20
+ DOUBLED_CONSONANTS_WITHOUT_C = (DOUBLED_CONSONANTS - ['c']).freeze
21
+ DOUBLED_CONSONANT_WITHOUT_C_PATTERN = "[#{DOUBLED_CONSONANTS_WITHOUT_C.join}]"
22
+ VOWELS = %w[a e i o u y].freeze
16
23
  VOWEL_PATTERN = "[#{VOWELS.join}]"
17
24
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :release do
4
+ desc 'generate changelog'
5
+ task :generate_changelog do |_task, _args|
6
+ `github_changelog_generator -u rossmeissl -p verbs`
7
+ end
8
+ end
data/test/helper.rb CHANGED
@@ -1,9 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'test/unit'
3
5
 
4
6
  $LOAD_PATH.unshift(File.dirname(__FILE__))
5
7
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
8
  require 'verbs'
7
-
8
- class Test::Unit::TestCase
9
- end
data/test/test_verbs.rb CHANGED
@@ -1,154 +1,324 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'helper'
2
4
 
3
5
  class TestVerbs < Test::Unit::TestCase
4
6
  def test_copular_conjugation
5
7
  # present habitual
6
- assert_equal 'am', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :first, :plurality => :singular, :aspect => :habitual)
7
- assert_equal 'are', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :second, :plurality => :singular, :aspect => :habitual)
8
- assert_equal 'is', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
9
- assert_equal 'are', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :first, :plurality => :plural, :aspect => :habitual)
10
- assert_equal 'are', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :third, :plurality => :plural, :aspect => :habitual)
8
+ assert_equal 'am',
9
+ Verbs::Conjugator.conjugate(:be, tense: :present, person: :first, plurality: :singular,
10
+ aspect: :habitual)
11
+ assert_equal 'are',
12
+ Verbs::Conjugator.conjugate(:be, tense: :present, person: :second, plurality: :singular,
13
+ aspect: :habitual)
14
+ assert_equal 'is',
15
+ Verbs::Conjugator.conjugate(:be, tense: :present, person: :third, plurality: :singular,
16
+ aspect: :habitual)
17
+ assert_equal 'are',
18
+ Verbs::Conjugator.conjugate(:be, tense: :present, person: :first, plurality: :plural,
19
+ aspect: :habitual)
20
+ assert_equal 'are',
21
+ Verbs::Conjugator.conjugate(:be, tense: :present, person: :third, plurality: :plural,
22
+ aspect: :habitual)
11
23
 
12
24
  # past
13
- assert_equal 'was', Verbs::Conjugator.conjugate(:be, :tense => :past)
25
+ assert_equal 'was', Verbs::Conjugator.conjugate(:be, tense: :past)
14
26
 
15
27
  # past habitual
16
- assert_equal 'used to be', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :first, :plurality => :singular, :aspect => :habitual)
17
- assert_equal 'used to be', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :second, :plurality => :singular, :aspect => :habitual)
18
- assert_equal 'used to be', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :third, :plurality => :singular, :aspect => :habitual)
19
- assert_equal 'used to be', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :first, :plurality => :plural, :aspect => :habitual)
20
- assert_equal 'used to be', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :third, :plurality => :plural, :aspect => :habitual)
21
-
22
- assert_equal 'was', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
23
- assert_equal 'were', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :second, :plurality => :singular, :aspect => :perfective)
24
- assert_equal 'was', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :third, :plurality => :singular, :aspect => :perfective)
25
- assert_equal 'were', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :first, :plurality => :plural, :aspect => :perfective)
26
- assert_equal 'were', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :third, :plurality => :plural, :aspect => :perfective)
27
-
28
- assert_equal 'was being', Verbs::Conjugator.conjugate(:be, :tense => :past, :person => :third, :aspect => :progressive)
29
- assert_equal 'is being', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :third, :aspect => :progressive)
30
- assert_equal 'will be being', Verbs::Conjugator.conjugate(:be, :tense => :future, :person => :third, :aspect => :progressive)
28
+ assert_equal 'used to be',
29
+ Verbs::Conjugator.conjugate(:be, tense: :past, person: :first, plurality: :singular, aspect: :habitual)
30
+ assert_equal 'used to be',
31
+ Verbs::Conjugator.conjugate(:be, tense: :past, person: :second, plurality: :singular,
32
+ aspect: :habitual)
33
+ assert_equal 'used to be',
34
+ Verbs::Conjugator.conjugate(:be, tense: :past, person: :third, plurality: :singular, aspect: :habitual)
35
+ assert_equal 'used to be',
36
+ Verbs::Conjugator.conjugate(:be, tense: :past, person: :first, plurality: :plural, aspect: :habitual)
37
+ assert_equal 'used to be',
38
+ Verbs::Conjugator.conjugate(:be, tense: :past, person: :third, plurality: :plural, aspect: :habitual)
39
+
40
+ assert_equal 'was',
41
+ Verbs::Conjugator.conjugate(:be, tense: :past, person: :first, plurality: :singular,
42
+ aspect: :perfective)
43
+ assert_equal 'were',
44
+ Verbs::Conjugator.conjugate(:be, tense: :past, person: :second, plurality: :singular,
45
+ aspect: :perfective)
46
+ assert_equal 'was',
47
+ Verbs::Conjugator.conjugate(:be, tense: :past, person: :third, plurality: :singular,
48
+ aspect: :perfective)
49
+ assert_equal 'were',
50
+ Verbs::Conjugator.conjugate(:be, tense: :past, person: :first, plurality: :plural, aspect: :perfective)
51
+ assert_equal 'were',
52
+ Verbs::Conjugator.conjugate(:be, tense: :past, person: :third, plurality: :plural, aspect: :perfective)
53
+
54
+ assert_equal 'was being',
55
+ Verbs::Conjugator.conjugate(:be, tense: :past, person: :third, aspect: :progressive)
56
+ assert_equal 'is being',
57
+ Verbs::Conjugator.conjugate(:be, tense: :present, person: :third, aspect: :progressive)
58
+ assert_equal 'will be being',
59
+ Verbs::Conjugator.conjugate(:be, tense: :future, person: :third, aspect: :progressive)
31
60
  end
61
+
32
62
  def test_irregular_conjugation
33
- assert_equal 'break', Verbs::Conjugator.conjugate(:break, :tense => :present, :person => :first, :plurality => :singular, :aspect => :habitual)
34
- assert_equal 'break', Verbs::Conjugator.conjugate(:break, :tense => :present, :person => :second, :plurality => :singular, :aspect => :habitual)
35
- assert_equal 'breaks', Verbs::Conjugator.conjugate(:break, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
36
- assert_equal 'break', Verbs::Conjugator.conjugate(:break, :tense => :present, :person => :first, :plurality => :plural, :aspect => :habitual)
37
- assert_equal 'break', Verbs::Conjugator.conjugate(:break, :tense => :present, :person => :third, :plurality => :plural, :aspect => :habitual)
38
- assert_equal 'broke', Verbs::Conjugator.conjugate(:break, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
39
- assert_equal 'broke', Verbs::Conjugator.conjugate(:break, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
40
- assert_equal 'broke', Verbs::Conjugator.conjugate(:break, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
41
- assert_equal 'broke', Verbs::Conjugator.conjugate(:break, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
42
- assert_equal 'broke', Verbs::Conjugator.conjugate(:break, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
43
- assert_equal 'has', Verbs::Conjugator.conjugate(:have, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
63
+ assert_equal 'break',
64
+ Verbs::Conjugator.conjugate(:break, tense: :present, person: :first, plurality: :singular,
65
+ aspect: :habitual)
66
+ assert_equal 'break',
67
+ Verbs::Conjugator.conjugate(:break, tense: :present, person: :second, plurality: :singular,
68
+ aspect: :habitual)
69
+ assert_equal 'breaks',
70
+ Verbs::Conjugator.conjugate(:break, tense: :present, person: :third, plurality: :singular,
71
+ aspect: :habitual)
72
+ assert_equal 'break',
73
+ Verbs::Conjugator.conjugate(:break, tense: :present, person: :first, plurality: :plural,
74
+ aspect: :habitual)
75
+ assert_equal 'break',
76
+ Verbs::Conjugator.conjugate(:break, tense: :present, person: :third, plurality: :plural,
77
+ aspect: :habitual)
78
+ assert_equal 'broke',
79
+ Verbs::Conjugator.conjugate(:break, tense: :past, person: :first, plurality: :singular,
80
+ aspect: :perfective)
81
+ assert_equal 'broke',
82
+ Verbs::Conjugator.conjugate(:break, tense: :past, person: :first, plurality: :singular,
83
+ aspect: :perfective)
84
+ assert_equal 'broke',
85
+ Verbs::Conjugator.conjugate(:break, tense: :past, person: :first, plurality: :singular,
86
+ aspect: :perfective)
87
+ assert_equal 'broke',
88
+ Verbs::Conjugator.conjugate(:break, tense: :past, person: :first, plurality: :singular,
89
+ aspect: :perfective)
90
+ assert_equal 'broke',
91
+ Verbs::Conjugator.conjugate(:break, tense: :past, person: :first, plurality: :singular,
92
+ aspect: :perfective)
93
+ assert_equal 'has',
94
+ Verbs::Conjugator.conjugate(:have, tense: :present, person: :third, plurality: :singular,
95
+ aspect: :habitual)
44
96
  end
97
+
45
98
  def test_know
46
- assert_equal 'knew', Verbs::Conjugator.conjugate(:know, :tense => :past)
47
- assert_equal 'had known', Verbs::Conjugator.conjugate(:know, :tense => :past, :person => :third, :plurality => :singular, :aspect => :perfect)
48
- assert_equal 'knew', Verbs::Conjugator.conjugate(:know, :tense => :past, :person => :third, :plurality => :singular, :aspect => :perfective)
49
- assert_equal 'was knowing', Verbs::Conjugator.conjugate(:know, :tense => :past, :person => :third, :plurality => :singular, :aspect => :progressive)
99
+ assert_equal 'knew', Verbs::Conjugator.conjugate(:know, tense: :past)
100
+ assert_equal 'had known',
101
+ Verbs::Conjugator.conjugate(:know, tense: :past, person: :third, plurality: :singular,
102
+ aspect: :perfect)
103
+ assert_equal 'knew',
104
+ Verbs::Conjugator.conjugate(:know, tense: :past, person: :third, plurality: :singular,
105
+ aspect: :perfective)
106
+ assert_equal 'was knowing',
107
+ Verbs::Conjugator.conjugate(:know, tense: :past, person: :third, plurality: :singular,
108
+ aspect: :progressive)
50
109
  end
110
+
51
111
  def test_irregular_conjugation_with_terminal_y
52
- assert_equal 'flies', Verbs::Conjugator.conjugate(:fly, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
53
- assert_equal 'carried', Verbs::Conjugator.conjugate(:carry, :tense => :past, :person => :third, :plurality => :singular, :aspect => :perfective)
54
- assert_equal 'stayed', Verbs::Conjugator.conjugate(:stay, :tense => :past, :person => :third, :plurality => :singular, :aspect => :perfective)
112
+ assert_equal 'flies',
113
+ Verbs::Conjugator.conjugate(:fly, tense: :present, person: :third, plurality: :singular,
114
+ aspect: :habitual)
115
+ assert_equal 'carried',
116
+ Verbs::Conjugator.conjugate(:carry, tense: :past, person: :third, plurality: :singular,
117
+ aspect: :perfective)
118
+ assert_equal 'stayed',
119
+ Verbs::Conjugator.conjugate(:stay, tense: :past, person: :third, plurality: :singular,
120
+ aspect: :perfective)
55
121
  end
122
+
56
123
  def test_regular_conjugation
57
- assert_equal 'accept', Verbs::Conjugator.conjugate(:accept, :tense => :present, :person => :first, :plurality => :singular, :aspect => :habitual)
58
- assert_equal 'accept', Verbs::Conjugator.conjugate(:accept, :tense => :present, :person => :second, :plurality => :singular, :aspect => :habitual)
59
- assert_equal 'accepts', Verbs::Conjugator.conjugate(:accept, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
60
- assert_equal 'accept', Verbs::Conjugator.conjugate(:accept, :tense => :present, :person => :first, :plurality => :plural, :aspect => :habitual)
61
- assert_equal 'accept', Verbs::Conjugator.conjugate(:accept, :tense => :present, :person => :third, :plurality => :plural, :aspect => :habitual)
62
- assert_equal 'accepted', Verbs::Conjugator.conjugate(:accept, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
63
- assert_equal 'accepted', Verbs::Conjugator.conjugate(:accept, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
64
- assert_equal 'accepted', Verbs::Conjugator.conjugate(:accept, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
65
- assert_equal 'accepted', Verbs::Conjugator.conjugate(:accept, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
66
- assert_equal 'accepted', Verbs::Conjugator.conjugate(:accept, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
124
+ assert_equal 'accept',
125
+ Verbs::Conjugator.conjugate(:accept, tense: :present, person: :first, plurality: :singular,
126
+ aspect: :habitual)
127
+ assert_equal 'accept',
128
+ Verbs::Conjugator.conjugate(:accept, tense: :present, person: :second, plurality: :singular,
129
+ aspect: :habitual)
130
+ assert_equal 'accepts',
131
+ Verbs::Conjugator.conjugate(:accept, tense: :present, person: :third, plurality: :singular,
132
+ aspect: :habitual)
133
+ assert_equal 'accept',
134
+ Verbs::Conjugator.conjugate(:accept, tense: :present, person: :first, plurality: :plural,
135
+ aspect: :habitual)
136
+ assert_equal 'accept',
137
+ Verbs::Conjugator.conjugate(:accept, tense: :present, person: :third, plurality: :plural,
138
+ aspect: :habitual)
139
+ assert_equal 'accepted',
140
+ Verbs::Conjugator.conjugate(:accept, tense: :past, person: :first, plurality: :singular,
141
+ aspect: :perfective)
142
+ assert_equal 'accepted',
143
+ Verbs::Conjugator.conjugate(:accept, tense: :past, person: :first, plurality: :singular,
144
+ aspect: :perfective)
145
+ assert_equal 'accepted',
146
+ Verbs::Conjugator.conjugate(:accept, tense: :past, person: :first, plurality: :singular,
147
+ aspect: :perfective)
148
+ assert_equal 'accepted',
149
+ Verbs::Conjugator.conjugate(:accept, tense: :past, person: :first, plurality: :singular,
150
+ aspect: :perfective)
151
+ assert_equal 'accepted',
152
+ Verbs::Conjugator.conjugate(:accept, tense: :past, person: :first, plurality: :singular,
153
+ aspect: :perfective)
67
154
  end
155
+
68
156
  def test_regular_conjugation_with_terminal_single_consonant
69
- assert_equal 'shipped', Verbs::Conjugator.conjugate(:ship, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
157
+ assert_equal 'shipped',
158
+ Verbs::Conjugator.conjugate(:ship, tense: :past, person: :first, plurality: :singular,
159
+ aspect: :perfective)
70
160
  end
161
+
71
162
  def test_regular_conjugation_with_irregular_terminal_consonant
72
- assert_equal 'abandoned', Verbs::Conjugator.conjugate(:abandon, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
73
- assert_equal 'followed', Verbs::Conjugator.conjugate(:follow, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
74
- assert_equal 'triggered', Verbs::Conjugator.conjugate(:trigger, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
75
- assert_equal 'colored', Verbs::Conjugator.conjugate(:color, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
76
- assert_equal 'delivered', Verbs::Conjugator.conjugate(:deliver, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
163
+ assert_equal 'abandoned',
164
+ Verbs::Conjugator.conjugate(:abandon, tense: :past, person: :first, plurality: :singular,
165
+ aspect: :perfective)
166
+ assert_equal 'followed',
167
+ Verbs::Conjugator.conjugate(:follow, tense: :past, person: :first, plurality: :singular,
168
+ aspect: :perfective)
169
+ assert_equal 'triggered',
170
+ Verbs::Conjugator.conjugate(:trigger, tense: :past, person: :first, plurality: :singular,
171
+ aspect: :perfective)
172
+ assert_equal 'colored',
173
+ Verbs::Conjugator.conjugate(:color, tense: :past, person: :first, plurality: :singular,
174
+ aspect: :perfective)
175
+ assert_equal 'delivered',
176
+ Verbs::Conjugator.conjugate(:deliver, tense: :past, person: :first, plurality: :singular,
177
+ aspect: :perfective)
77
178
  end
179
+
78
180
  def test_regular_conjugation_with_ean_suffix
79
- assert_equal 'cleaned', Verbs::Conjugator.conjugate(:clean, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
80
- assert_equal 'am cleaning', Verbs::Conjugator.conjugate(:clean, :tense => :present, :person => :first, :plurality => :singular, :aspect => :progressive)
181
+ assert_equal 'cleaned',
182
+ Verbs::Conjugator.conjugate(:clean, tense: :past, person: :first, plurality: :singular,
183
+ aspect: :perfective)
184
+ assert_equal 'am cleaning',
185
+ Verbs::Conjugator.conjugate(:clean, tense: :present, person: :first, plurality: :singular,
186
+ aspect: :progressive)
81
187
  end
188
+
82
189
  def test_regular_non_doubled_ending_consonant
83
- assert_equal 'fixes', Verbs::Conjugator.conjugate(:fix, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
84
- assert_equal 'fixed', Verbs::Conjugator.conjugate(:fix, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
85
- assert_equal 'faxed', Verbs::Conjugator.conjugate(:fax, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
190
+ assert_equal 'fixes',
191
+ Verbs::Conjugator.conjugate(:fix, tense: :present, person: :third, plurality: :singular,
192
+ aspect: :habitual)
193
+ assert_equal 'fixed',
194
+ Verbs::Conjugator.conjugate(:fix, tense: :past, person: :first, plurality: :singular,
195
+ aspect: :perfective)
196
+ assert_equal 'faxed',
197
+ Verbs::Conjugator.conjugate(:fax, tense: :past, person: :first, plurality: :singular,
198
+ aspect: :perfective)
86
199
  end
200
+
87
201
  def test_regular_conjugation_with_terminal_e
88
- assert_equal 'created', Verbs::Conjugator.conjugate(:create, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
89
- assert_equal 'was hiding', Verbs::Conjugator.conjugate(:hide, :tense => :past, :person => :first, :plurality => :singular, :aspect => :progressive)
202
+ assert_equal 'created',
203
+ Verbs::Conjugator.conjugate(:create, tense: :past, person: :first, plurality: :singular,
204
+ aspect: :perfective)
205
+ assert_equal 'was hiding',
206
+ Verbs::Conjugator.conjugate(:hide, tense: :past, person: :first, plurality: :singular,
207
+ aspect: :progressive)
90
208
  end
209
+
210
+ def test_regular_conjugation_with_terminal_c
211
+ assert_equal 'mimicked', Verbs::Conjugator.conjugate(:mimic, tense: :past, aspect: :perfective)
212
+ assert_equal 'was mimicking', Verbs::Conjugator.conjugate(:mimic, tense: :past, person: :first, plurality: :singular,
213
+ aspect: :progressive)
214
+ assert_equal 'panicked', Verbs::Conjugator.conjugate(:panic, tense: :past, aspect: :perfective)
215
+ assert_equal 'was panicking', Verbs::Conjugator.conjugate(:panic, tense: :past, person: :first, plurality: :singular,
216
+ aspect: :progressive)
217
+ end
218
+
91
219
  def test_regular_conjugation_with_unusual_terminal_e
92
- assert_equal 'dyed', Verbs::Conjugator.conjugate(:dye, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
93
- assert_equal 'hoed', Verbs::Conjugator.conjugate(:hoe, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
94
- assert_equal 'singed', Verbs::Conjugator.conjugate(:singe, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
95
- assert_equal 'tied', Verbs::Conjugator.conjugate(:tie, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
96
- assert_equal 'agreed', Verbs::Conjugator.conjugate(:agree, :tense => :past, :person => :first, :plurality => :singular, :aspect => :perfective)
220
+ assert_equal 'dyed',
221
+ Verbs::Conjugator.conjugate(:dye, tense: :past, person: :first, plurality: :singular,
222
+ aspect: :perfective)
223
+ assert_equal 'hoed',
224
+ Verbs::Conjugator.conjugate(:hoe, tense: :past, person: :first, plurality: :singular,
225
+ aspect: :perfective)
226
+ assert_equal 'singed',
227
+ Verbs::Conjugator.conjugate(:singe, tense: :past, person: :first, plurality: :singular,
228
+ aspect: :perfective)
229
+ assert_equal 'tied',
230
+ Verbs::Conjugator.conjugate(:tie, tense: :past, person: :first, plurality: :singular,
231
+ aspect: :perfective)
232
+ assert_equal 'agreed',
233
+ Verbs::Conjugator.conjugate(:agree, tense: :past, person: :first, plurality: :singular,
234
+ aspect: :perfective)
235
+ assert_equal 'is tying', Verbs::Conjugator.conjugate(:tie, plurality: :singular, aspect: :progressive)
236
+ assert_equal 'was tying', Verbs::Conjugator.conjugate(:tie, tense: :past, plurality: :singular, aspect: :progressive)
237
+ assert_equal 'issued',
238
+ Verbs::Conjugator.conjugate(:issue, tense: :past, person: :first, plurality: :singular, aspect: :perfective)
239
+ assert_equal 'was issuing', Verbs::Conjugator.conjugate(:issue, tense: :past, plurality: :singular, aspect: :progressive)
97
240
  end
241
+
98
242
  def test_conjugation_with_terminal_sibilance
99
- assert_equal 'passes', Verbs::Conjugator.conjugate(:pass, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
100
- assert_equal 'focusses', Verbs::Conjugator.conjugate(:focus, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
101
- assert_equal 'buzzes', Verbs::Conjugator.conjugate(:buzz, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
102
- assert_equal 'coaxes', Verbs::Conjugator.conjugate(:coax, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
103
- assert_equal 'washes', Verbs::Conjugator.conjugate(:wash, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
104
- assert_equal 'watches', Verbs::Conjugator.conjugate(:watch, :tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
243
+ assert_equal 'passes',
244
+ Verbs::Conjugator.conjugate(:pass, tense: :present, person: :third, plurality: :singular,
245
+ aspect: :habitual)
246
+ assert_equal 'focusses',
247
+ Verbs::Conjugator.conjugate(:focus, tense: :present, person: :third, plurality: :singular,
248
+ aspect: :habitual)
249
+ assert_equal 'buzzes',
250
+ Verbs::Conjugator.conjugate(:buzz, tense: :present, person: :third, plurality: :singular,
251
+ aspect: :habitual)
252
+ assert_equal 'coaxes',
253
+ Verbs::Conjugator.conjugate(:coax, tense: :present, person: :third, plurality: :singular,
254
+ aspect: :habitual)
255
+ assert_equal 'washes',
256
+ Verbs::Conjugator.conjugate(:wash, tense: :present, person: :third, plurality: :singular,
257
+ aspect: :habitual)
258
+ assert_equal 'watches',
259
+ Verbs::Conjugator.conjugate(:watch, tense: :present, person: :third, plurality: :singular,
260
+ aspect: :habitual)
105
261
  end
262
+
106
263
  def test_conjugation_with_subject
107
- assert_equal 'Matz is', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :third, :plurality => :singular, :subject => 'Matz', :aspect => :habitual)
108
- assert_equal 'We are', Verbs::Conjugator.conjugate(:be, :tense => :present, :person => :first, :plurality => :plural, :subject => true, :aspect => :habitual)
264
+ assert_equal 'Matz is',
265
+ Verbs::Conjugator.conjugate(:be, tense: :present, person: :third, plurality: :singular, subject: 'Matz',
266
+ aspect: :habitual)
267
+ assert_equal 'We are',
268
+ Verbs::Conjugator.conjugate(:be, tense: :present, person: :first, plurality: :plural, subject: true,
269
+ aspect: :habitual)
109
270
  end
271
+
110
272
  def test_conjugation_with_false_subject
111
- assert_equal 'accepts', Verbs::Conjugator.conjugate(:accept, :subject => false)
273
+ assert_equal 'accepts', Verbs::Conjugator.conjugate(:accept, subject: false)
112
274
  end
275
+
113
276
  def test_core_access
114
- assert_equal :accepts, :accept.verb.conjugate(:tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
115
- assert_equal 'accepts', 'accept'.verb.conjugate(:tense => :present, :person => :third, :plurality => :singular, :aspect => :habitual)
116
- assert_equal 'Girl is Near', 'Be Near'.verb.conjugate(:subject => 'Girl')
277
+ assert_equal :accepts,
278
+ :accept.verb.conjugate(tense: :present, person: :third, plurality: :singular, aspect: :habitual)
279
+ assert_equal 'accepts',
280
+ 'accept'.verb.conjugate(tense: :present, person: :third, plurality: :singular, aspect: :habitual)
281
+ assert_equal 'Girl is Near', 'Be Near'.verb.conjugate(subject: 'Girl')
117
282
  end
283
+
118
284
  def test_aspects
119
- Verbs::Conjugator.with_options :person => :first, :plurality => :singular, :subject => true do |standard|
120
- assert_equal 'I used to accept', standard.conjugate(:accept, :tense => :past, :aspect => :habitual)
121
- assert_equal 'I had accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfect)
122
- assert_equal 'I accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfective)
123
- assert_equal 'I was accepting', standard.conjugate(:accept, :tense => :past, :aspect => :progressive)
124
- assert_equal 'I was about to accept', standard.conjugate(:accept, :tense => :past, :aspect => :prospective)
125
- assert_equal 'I accept', standard.conjugate(:accept, :tense => :present, :aspect => :habitual)
126
- assert_equal 'I have accepted', standard.conjugate(:accept, :tense => :present, :aspect => :perfect)
127
- assert_equal 'I am having accepted', standard.conjugate(:accept, :tense => :present, :aspect => :perfective)
128
- assert_equal 'I am accepting', standard.conjugate(:accept, :tense => :present, :aspect => :progressive)
129
- assert_equal 'I am about to accept', standard.conjugate(:accept, :tense => :present, :aspect => :prospective)
130
- assert_equal 'I will accept', standard.conjugate(:accept, :tense => :future, :aspect => :habitual)
131
- assert_equal 'I will have accepted', standard.conjugate(:accept, :tense => :future, :aspect => :perfect)
132
- assert_equal 'I will be having accepted', standard.conjugate(:accept, :tense => :future, :aspect => :perfective)
133
- assert_equal 'I will be accepting', standard.conjugate(:accept, :tense => :future, :aspect => :progressive)
134
- assert_equal 'I will be about to accept', standard.conjugate(:accept, :tense => :future, :aspect => :prospective)
285
+ Verbs::Conjugator.with_options person: :first, plurality: :singular, subject: true do |standard|
286
+ assert_equal 'I used to accept', standard.conjugate(:accept, tense: :past, aspect: :habitual)
287
+ assert_equal 'I had accepted', standard.conjugate(:accept, tense: :past, aspect: :perfect)
288
+ assert_equal 'I accepted', standard.conjugate(:accept, tense: :past, aspect: :perfective)
289
+ assert_equal 'I was accepting', standard.conjugate(:accept, tense: :past, aspect: :progressive)
290
+ assert_equal 'I was about to accept', standard.conjugate(:accept, tense: :past, aspect: :prospective)
291
+ assert_equal 'I accept', standard.conjugate(:accept, tense: :present, aspect: :habitual)
292
+ assert_equal 'I have accepted', standard.conjugate(:accept, tense: :present, aspect: :perfect)
293
+ assert_equal 'I am having accepted', standard.conjugate(:accept, tense: :present, aspect: :perfective)
294
+ assert_equal 'I am accepting', standard.conjugate(:accept, tense: :present, aspect: :progressive)
295
+ assert_equal 'I am about to accept', standard.conjugate(:accept, tense: :present, aspect: :prospective)
296
+ assert_equal 'I will accept', standard.conjugate(:accept, tense: :future, aspect: :habitual)
297
+ assert_equal 'I will have accepted', standard.conjugate(:accept, tense: :future, aspect: :perfect)
298
+ assert_equal 'I will be having accepted', standard.conjugate(:accept, tense: :future, aspect: :perfective)
299
+ assert_equal 'I will be accepting', standard.conjugate(:accept, tense: :future, aspect: :progressive)
300
+ assert_equal 'I will be about to accept', standard.conjugate(:accept, tense: :future, aspect: :prospective)
135
301
  end
136
302
  end
303
+
137
304
  def test_mood
138
- assert_equal Verbs::Conjugator.conjugate(:accept, :person => :third), Verbs::Conjugator.conjugate(:accept, :person => :third, :mood => :indicative)
139
- assert_equal 'accept', Verbs::Conjugator.conjugate(:accept, :person => :third, :mood => :subjunctive)
140
- assert_equal 'be', Verbs::Conjugator.conjugate(:be, :mood => :subjunctive, :tense => :present)
141
- assert_equal 'were', Verbs::Conjugator.conjugate(:be, :mood => :subjunctive, :tense => :past, :aspect => :perfective)
142
- assert_equal 'accept', Verbs::Conjugator.conjugate(:accept, :person => :second, :mood => :imperative)
305
+ assert_equal Verbs::Conjugator.conjugate(:accept, person: :third),
306
+ Verbs::Conjugator.conjugate(:accept, person: :third, mood: :indicative)
307
+ assert_equal 'accept', Verbs::Conjugator.conjugate(:accept, person: :third, mood: :subjunctive)
308
+ assert_equal 'be', Verbs::Conjugator.conjugate(:be, mood: :subjunctive, tense: :present)
309
+ assert_equal 'were',
310
+ Verbs::Conjugator.conjugate(:be, mood: :subjunctive, tense: :past, aspect: :perfective)
311
+ assert_equal 'accept', Verbs::Conjugator.conjugate(:accept, person: :second, mood: :imperative)
143
312
  end
313
+
144
314
  def test_improper_construction
145
315
  assert_raise Verbs::ImproperConstruction do
146
- Verbs::Conjugator.conjugate(:accept, :mood => :imperative)
316
+ Verbs::Conjugator.conjugate(:accept, mood: :imperative)
147
317
  end
148
318
  end
149
319
 
150
320
  def test_s_forms
151
- Verbs::Conjugator.with_options :person => :third, :tense => :present do |standard|
321
+ Verbs::Conjugator.with_options person: :third, tense: :present do |standard|
152
322
  assert_equal 'does', standard.conjugate('do')
153
323
  assert_equal 'flies', standard.conjugate('fly')
154
324
  assert_equal 'assesses', standard.conjugate('assess')
@@ -167,54 +337,84 @@ class TestVerbs < Test::Unit::TestCase
167
337
 
168
338
  def test_immutability
169
339
  verb = 'like'
170
- Verbs::Conjugator.conjugate(verb, :tense => :past, :aspect => :perfective)
340
+ Verbs::Conjugator.conjugate(verb, tense: :past, aspect: :perfective)
171
341
  assert_equal 'like', verb
172
342
  end
173
343
 
174
344
  def test_second_person_plural_forms
175
- Verbs::Conjugator.with_options :person => :second, :plurality => :plural, :subject => true do |standard|
176
- assert_equal 'You had accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfect)
177
- assert_equal 'You accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfective)
178
- assert_equal 'You were accepting', standard.conjugate(:accept, :tense => :past, :aspect => :progressive)
179
- assert_equal 'You were about to accept', standard.conjugate(:accept, :tense => :past, :aspect => :prospective)
345
+ Verbs::Conjugator.with_options person: :second, plurality: :plural, subject: true do |standard|
346
+ assert_equal 'You had accepted', standard.conjugate(:accept, tense: :past, aspect: :perfect)
347
+ assert_equal 'You accepted', standard.conjugate(:accept, tense: :past, aspect: :perfective)
348
+ assert_equal 'You were accepting', standard.conjugate(:accept, tense: :past, aspect: :progressive)
349
+ assert_equal 'You were about to accept', standard.conjugate(:accept, tense: :past, aspect: :prospective)
180
350
  end
181
351
  end
182
352
 
183
353
  def test_passive
184
- Verbs::Conjugator.with_options :diathesis => :passive, :person => :first, :plurality => :singular, :subject => true do |standard|
185
- assert_equal 'I used to be accepted', standard.conjugate(:accept, :tense => :past, :aspect => :habitual)
186
- assert_equal 'I had been accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfect)
187
- assert_equal 'I was accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfective)
188
- assert_equal 'I was being accepted', standard.conjugate(:accept, :tense => :past, :aspect => :progressive)
189
- assert_equal 'I was about to be accepted', standard.conjugate(:accept, :tense => :past, :aspect => :prospective)
190
- assert_equal 'I am accepted', standard.conjugate(:accept, :tense => :present, :aspect => :habitual)
191
- assert_equal 'I have been accepted', standard.conjugate(:accept, :tense => :present, :aspect => :perfect)
192
- assert_equal 'I am being accepted', standard.conjugate(:accept, :tense => :present, :aspect => :progressive)
193
- assert_equal 'I am about to be accepted', standard.conjugate(:accept, :tense => :present, :aspect => :prospective)
194
- assert_equal 'I will be accepted', standard.conjugate(:accept, :tense => :future, :aspect => :habitual)
195
- assert_equal 'I will have been accepted', standard.conjugate(:accept, :tense => :future, :aspect => :perfect)
196
- assert_equal 'I will be being accepted', standard.conjugate(:accept, :tense => :future, :aspect => :progressive)
197
- assert_equal 'I will be about to be accepted', standard.conjugate(:accept, :tense => :future, :aspect => :prospective)
354
+ Verbs::Conjugator.with_options diathesis: :passive, person: :first, plurality: :singular,
355
+ subject: true do |standard|
356
+ assert_equal 'I used to be accepted', standard.conjugate(:accept, tense: :past, aspect: :habitual)
357
+ assert_equal 'I had been accepted', standard.conjugate(:accept, tense: :past, aspect: :perfect)
358
+ assert_equal 'I was accepted',
359
+ standard.conjugate(:accept, tense: :past, aspect: :perfective)
360
+ assert_equal 'I was being accepted',
361
+ standard.conjugate(:accept, tense: :past, aspect: :progressive)
362
+ assert_equal 'I was about to be accepted',
363
+ standard.conjugate(:accept, tense: :past, aspect: :prospective)
364
+ assert_equal 'I am accepted',
365
+ standard.conjugate(:accept, tense: :present, aspect: :habitual)
366
+ assert_equal 'I have been accepted',
367
+ standard.conjugate(:accept, tense: :present, aspect: :perfect)
368
+ assert_equal 'I am being accepted',
369
+ standard.conjugate(:accept, tense: :present, aspect: :progressive)
370
+ assert_equal 'I am about to be accepted',
371
+ standard.conjugate(:accept, tense: :present, aspect: :prospective)
372
+ assert_equal 'I will be accepted',
373
+ standard.conjugate(:accept, tense: :future, aspect: :habitual)
374
+ assert_equal 'I will have been accepted', standard.conjugate(:accept, tense: :future, aspect: :perfect)
375
+ assert_equal 'I will be being accepted',
376
+ standard.conjugate(:accept, tense: :future, aspect: :progressive)
377
+ assert_equal 'I will be about to be accepted',
378
+ standard.conjugate(:accept, tense: :future, aspect: :prospective)
198
379
  end
199
380
 
200
- Verbs::Conjugator.with_options :diathesis => :passive, :person => :third, :plurality => :plural, :subject => true do |standard|
201
- assert_equal 'They used to be accepted', standard.conjugate(:accept, :tense => :past, :aspect => :habitual)
202
- assert_equal 'They had been accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfect)
203
- assert_equal 'They were accepted', standard.conjugate(:accept, :tense => :past, :aspect => :perfective)
204
- assert_equal 'They were being accepted', standard.conjugate(:accept, :tense => :past, :aspect => :progressive)
205
- assert_equal 'They were about to be accepted', standard.conjugate(:accept, :tense => :past, :aspect => :prospective)
206
- assert_equal 'They are accepted', standard.conjugate(:accept, :tense => :present, :aspect => :habitual)
207
- assert_equal 'They have been accepted', standard.conjugate(:accept, :tense => :present, :aspect => :perfect)
208
- assert_equal 'They are being accepted', standard.conjugate(:accept, :tense => :present, :aspect => :progressive)
209
- assert_equal 'They are about to be accepted', standard.conjugate(:accept, :tense => :present, :aspect => :prospective)
210
- assert_equal 'They will be accepted', standard.conjugate(:accept, :tense => :future, :aspect => :habitual)
211
- assert_equal 'They will have been accepted', standard.conjugate(:accept, :tense => :future, :aspect => :perfect)
212
- assert_equal 'They will be being accepted', standard.conjugate(:accept, :tense => :future, :aspect => :progressive)
213
- assert_equal 'They will be about to be accepted', standard.conjugate(:accept, :tense => :future, :aspect => :prospective)
381
+ Verbs::Conjugator.with_options diathesis: :passive, person: :third, plurality: :plural,
382
+ subject: true do |standard|
383
+ assert_equal 'They used to be accepted',
384
+ standard.conjugate(:accept, tense: :past, aspect: :habitual)
385
+ assert_equal 'They had been accepted',
386
+ standard.conjugate(:accept, tense: :past, aspect: :perfect)
387
+ assert_equal 'They were accepted',
388
+ standard.conjugate(:accept, tense: :past, aspect: :perfective)
389
+ assert_equal 'They were being accepted',
390
+ standard.conjugate(:accept, tense: :past, aspect: :progressive)
391
+ assert_equal 'They were about to be accepted',
392
+ standard.conjugate(:accept, tense: :past, aspect: :prospective)
393
+ assert_equal 'They are accepted',
394
+ standard.conjugate(:accept, tense: :present, aspect: :habitual)
395
+ assert_equal 'They have been accepted',
396
+ standard.conjugate(:accept, tense: :present, aspect: :perfect)
397
+ assert_equal 'They are being accepted',
398
+ standard.conjugate(:accept, tense: :present, aspect: :progressive)
399
+ assert_equal 'They are about to be accepted',
400
+ standard.conjugate(:accept, tense: :present, aspect: :prospective)
401
+ assert_equal 'They will be accepted',
402
+ standard.conjugate(:accept, tense: :future, aspect: :habitual)
403
+ assert_equal 'They will have been accepted',
404
+ standard.conjugate(:accept, tense: :future, aspect: :perfect)
405
+ assert_equal 'They will be being accepted',
406
+ standard.conjugate(:accept, tense: :future, aspect: :progressive)
407
+ assert_equal 'They will be about to be accepted',
408
+ standard.conjugate(:accept, tense: :future, aspect: :prospective)
214
409
  end
215
410
 
216
411
  assert_raise Verbs::ImproperConstruction do
217
- Verbs::Conjugator.conjugate(:be, :diathesis => :passive)
412
+ Verbs::Conjugator.conjugate(:be, diathesis: :passive)
218
413
  end
219
414
  end
415
+
416
+ def test_not_modifying_frozen_string
417
+ assert_equal 'is mimicking', Verbs::Conjugator.conjugate(:mimic, aspect: :progressive)
418
+ assert_equal 'was mimicking', Verbs::Conjugator.conjugate(:mimic, tense: :past, aspect: :progressive)
419
+ end
220
420
  end