libclimate-ruby 0.17.0.2 → 0.17.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7b6f4c5f156a946859492ec967c988d60b88d6b18ba7a65ec6cc96d2637577d
4
- data.tar.gz: 025f947721e7a9a391621662ddcf41d9979b571e20f1fc93a6eb27ee670c16ac
3
+ metadata.gz: c1014739a5918db9efeb5135cf15f993bdd7ef3e09192661b9ea204ff56162f0
4
+ data.tar.gz: 74d345f4b3bb769d416b0a13adf6483810855426b7fcc38a78fc62086b391b9e
5
5
  SHA512:
6
- metadata.gz: 8d5164021d09906286cd941cb4eab755b271b2bde0a3d147533c3d501ff64907f25207cbcb07c191f936a04911fab173f550baa96414c623d0e101cd17b40b2a
7
- data.tar.gz: 829552df92abca1ab265bd93ceb1aec33a6e47bb05e717d6bc4530265a7210228222aa3514827f15b40a0959511d7cce8dfc0a75e8d04adb82e43db5097c5e14
6
+ metadata.gz: 622c85547fcf19727ee1fda68455440791001652d4d29d323f051061ac426b493aecab3cd7be8bb89b53403aa53a397b83139d5228b854eff577443597a5a463
7
+ data.tar.gz: c55439ac1104533836c03f9a786d1a2ab80677a4a8b3947ea46ffb103ac81686906ddcc910a8c80bd43247b974a672ce8dd8219614a7098d7786bc012c0c869c
@@ -5,13 +5,13 @@
5
5
  # Purpose: Definition of the ::LibCLImate::Climate class
6
6
  #
7
7
  # Created: 13th July 2015
8
- # Updated: 6th March 2025
8
+ # Updated: 30th July 2026
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/libCLImate.Ruby
11
11
  #
12
12
  # Author: Matthew Wilson
13
13
  #
14
- # Copyright (c) 2019-2025, Matthew Wilson and Synesis Information Systems
14
+ # Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems
15
15
  # Copyright (c) 2015-2019, Matthew Wilson and Synesis Software
16
16
  # All rights reserved.
17
17
  #
@@ -264,7 +264,7 @@ class Climate
264
264
  end
265
265
  else
266
266
 
267
- message = make_abort_message_("unrecognised flag '#{f}'")
267
+ message = climate.make_abort_message_("unrecognised flag '#{flag}'")
268
268
 
269
269
  if false
270
270
 
@@ -312,7 +312,7 @@ class Climate
312
312
  end
313
313
  else
314
314
 
315
- message = make_abort_message_("unrecognised option '#{f}'")
315
+ message = climate.make_abort_message_("unrecognised option '#{option}'")
316
316
 
317
317
  if false
318
318
 
@@ -378,6 +378,7 @@ class Climate
378
378
  GIVEN_SPECS_ = "_Given_Specs_01B59422_8407_4c89_9432_8160C52BD5AD"
379
379
  end # module Climate_Constants_
380
380
 
381
+ public
381
382
  def make_abort_message_(msg)
382
383
 
383
384
  if 0 != (usage_help_suffix || 0).size
@@ -44,7 +44,7 @@
44
44
  module LibCLImate
45
45
 
46
46
  # Current version of the libCLImate.Ruby library
47
- VERSION = '0.17.0.2'
47
+ VERSION = '0.17.1'
48
48
 
49
49
  private
50
50
  VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
@@ -156,5 +156,85 @@ class Test_Climate_parse_and_verify < Test::Unit::TestCase
156
156
  climate.parse_and_verify argv, raise_on_required: MissingRequiredException
157
157
  end
158
158
  end
159
+
160
+ def test_unrecognized_flag_raises_unrecognised_argument_exception
161
+
162
+ stdout = StringIO.new
163
+ stderr = StringIO.new
164
+
165
+ climate = LibCLImate::Climate.new do |cl|
166
+
167
+ cl.stdout = $stdout
168
+ cl.stderr = $stderr
169
+ end
170
+
171
+ assert $stdout.equal? climate.stdout
172
+ assert $stderr.equal? climate.stderr
173
+
174
+ argv = [
175
+
176
+ '--unrecognised-flag',
177
+ ]
178
+
179
+ assert_raise_with_message(UnrecognisedArgumentException, /unrecognised flag '--unrecognised-flag'/) do
180
+
181
+ climate.parse_and_verify argv, raise_on_unrecognised: UnrecognisedArgumentException
182
+ end
183
+ end
184
+
185
+ def test_unrecognized_option_raises_unrecognised_argument_exception
186
+
187
+ stdout = StringIO.new
188
+ stderr = StringIO.new
189
+
190
+ climate = LibCLImate::Climate.new do |cl|
191
+
192
+ cl.stdout = $stdout
193
+ cl.stderr = $stderr
194
+ end
195
+
196
+ assert $stdout.equal? climate.stdout
197
+ assert $stderr.equal? climate.stderr
198
+
199
+ argv = [
200
+
201
+ '--unrecognised-option=some_value',
202
+ ]
203
+
204
+ assert_raise_with_message(UnrecognisedArgumentException, /unrecognised option '--unrecognised-option=some_value'/) do
205
+
206
+ climate.parse_and_verify argv, raise_on_unrecognised: UnrecognisedArgumentException
207
+ end
208
+ end
209
+
210
+ def test_add_flag_method_exists_and_is_callable
211
+
212
+ climate = LibCLImate::Climate.new {}
213
+
214
+ # Assert that calling add_flag does not raise an exception
215
+ assert_nothing_raised do
216
+
217
+ climate.add_flag('--test-flag')
218
+ end
219
+
220
+ # Verify that the flag is added to specifications
221
+ assert_equal 3, climate.specifications.size
222
+ assert_equal '--test-flag', climate.specifications[2].name
223
+ end
224
+
225
+ def test_add_option_method_exists_and_is_callable
226
+
227
+ climate = LibCLImate::Climate.new {}
228
+
229
+ # Assert that calling add_option does not raise an exception
230
+ assert_nothing_raised do
231
+
232
+ climate.add_option('--test-option')
233
+ end
234
+
235
+ # Verify that the option is added to specifications
236
+ assert_equal 3, climate.specifications.size
237
+ assert_equal '--test-option', climate.specifications[2].name
238
+ end
159
239
  end
160
240
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libclimate-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0.2
4
+ version: 0.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson