oktest 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a67a9622ea13bcbb40bf426b2e6321619256062ab2db5d7e4e951cb51d2e5beb
4
- data.tar.gz: 420f3f9da92864fdc96a8cd1dc53e8ae369527445b03f1d6ddcf004b5a9f60b1
3
+ metadata.gz: 65c65e47a706541792e7ba1e9705dc03af1c2fe46c87141472659fb811463e76
4
+ data.tar.gz: c405d466c9b63eb3897754716d220f884af655cceba5cc7c644e742caf22b465
5
5
  SHA512:
6
- metadata.gz: ff57c813e8aca8c7136c0fe98850894602d49c4d38bf4d151d05281ddd5c73cd06773e275ae79103862908cdea242b82130eddc81e5f3b68391ce5d85cc5ccb9
7
- data.tar.gz: 155d0e8d7d7f606b2ebe41643fd4fccf34f5dd4c4882b555a6c9137682f65ca37d5c701e6cb7cdce1f0679cf4a2ef0403b45780dbe9506c6d5640106d4d7d76a
6
+ metadata.gz: 496909751ed5b3035d07091c0dc362af3586e85e144177603f15035e178fa5f1d9e31c70bd1da7c60059efd8c3275c781e5876af45ac144f4d56fccf444fea20
7
+ data.tar.gz: e7d440c6dcdbccefe33e99be638dc0f70aae187ee49f0fc091ea631f55e93da822b22804bfa57d570bf9190440c248783564724fa7998df4b0e9b0a6eb0f7ed3
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2021 kuwata-lab.com all rights reserved
1
+ Copyright (c) 2011-2024 kuwata-lab.com all rights reserved
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -817,10 +817,15 @@ ok {pr}.raise?(NoMethodError) {|exc|
817
817
  ok {exc.class} == NoMethodError
818
818
  ok {exc.message} == "undefined method `len' for \"abc\":String"
819
819
  }
820
+ ## or (Oktest.rb >= 1.3)
821
+ exc = ok {pr}.raise?(NoMethodError)
822
+ ok {exc.class} == NoMethodError
823
+ ok {exc.message} == "undefined method `len' for \"abc\":String"
820
824
 
821
825
  ## assert that procedure does NOT raise any exception
822
- ok {pr}.NOT.raise? # no exception class nor error message
823
- not_ok {pr}.raise? # same as above
826
+ ok {pr}.raise_nothing? # (>= Oktest 1.3)
827
+ ok {pr}.NOT.raise? # no exception class nor error message
828
+ not_ok {pr}.raise? # same as above
824
829
 
825
830
  ## assert that procedure throws symbol.
826
831
  pr2 = proc do
@@ -829,8 +834,8 @@ end
829
834
  ok {pr2}.throw?(:quit) # pass if :quit thrown, fail if other or nothing thrown
830
835
  ```
831
836
 
832
- If procedure contains `raise "errmsg"` instead of `raise ErrorClass, "errmsg"`,
833
- you can omit exception class such as `ok {pr}.raise?("errmsg")`.
837
+ If a procedure contains `raise "errmsg"` instead of `raise ErrorClass, "errmsg"`,
838
+ you can omit exception class like `ok {pr}.raise?("errmsg")`.
834
839
 
835
840
  <!--
836
841
  test/example14b_test.rb:
@@ -939,7 +944,7 @@ require 'oktest'
939
944
 
940
945
  Oktest::AssertionObject.class_eval do
941
946
  def readable? # custom assertion: file readable?
942
- _done()
947
+ __done()
943
948
  result = File.readable?(@actual)
944
949
  __assert(result == @bool) {
945
950
  "File.readable?($<actual>) == #{@bool}: failed.\n" +
@@ -2265,4 +2270,4 @@ See [CHANGES.md](https://github.com/kwatch/oktest/blob/ruby/ruby/CHANGES.md).
2265
2270
  ## License and Copyright
2266
2271
 
2267
2272
  * $License: MIT License $
2268
- * $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
2273
+ * $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
data/Rakefile.rb CHANGED
@@ -1,17 +1,17 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
9
9
  PROJECT = "oktest"
10
10
  RELEASE = ENV['RELEASE'] || "0.0.0"
11
- COPYRIGHT = "copyright(c) 2011-2021 kuwata-lab.com all rights reserved"
11
+ COPYRIGHT = "copyright(c) 2011-2024 kuwata-lab.com all rights reserved"
12
12
  LICENSE = "MIT License"
13
13
 
14
- $ruby_versions ||= %w[2.4 2.5 2.6 2.7 3.0]
14
+ $ruby_versions ||= %w[2.4 2.5 2.6 2.7 3.0 3.1 3.2 3.3]
15
15
 
16
16
  desc "show release guide"
17
17
  task :guide do
data/lib/oktest.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
@@ -12,7 +12,7 @@ require 'set'
12
12
  module Oktest
13
13
 
14
14
 
15
- VERSION = '$Release: 1.2.1 $'.split()[1]
15
+ VERSION = '$Release: 1.3.0 $'.split()[1]
16
16
 
17
17
 
18
18
  class OktestError < StandardError
@@ -236,14 +236,29 @@ module Oktest
236
236
  self
237
237
  end
238
238
 
239
- def method_missing(method_name, *args)
239
+ if RUBY_VERSION >= "2.7"
240
+ def method_missing(method_name, *args, **kwargs, &b)
241
+ #; [!ttow6] raises NoMethodError when not a boolean method.
242
+ return super unless method_name.to_s =~ /\?\z/
243
+ #; [!gd3vg] supports keyword arguments on Ruby >= 2.7.
244
+ __method_missing(method_name, args, kwargs) {
245
+ @actual.__send__(method_name, *args, **kwargs, &b)
246
+ }
247
+ end
248
+ else
249
+ def method_missing(method_name, *args, &b)
250
+ return super unless method_name.to_s =~ /\?\z/
251
+ __method_missing(method_name, args, nil) {
252
+ @actual.__send__(method_name, *args, &b)
253
+ }
254
+ end
255
+ end
256
+
257
+ def __method_missing(method_name, args, kwargs)
240
258
  __done()
241
259
  #; [!yjnxb] enables to handle boolean methods.
242
- #; [!ttow6] raises NoMethodError when not a boolean method.
243
- method_name.to_s =~ /\?\z/ or
244
- super
245
260
  begin
246
- ret = @actual.__send__(method_name, *args)
261
+ ret = yield
247
262
  rescue NoMethodError, TypeError => exc
248
263
  #; [!f0ekh] skip top of backtrace when NoMethodError raised.
249
264
  while !exc.backtrace.empty? && exc.backtrace[0].start_with?(__FILE__)
@@ -254,10 +269,11 @@ module Oktest
254
269
  #; [!cun59] fails when boolean method failed returned false.
255
270
  #; [!4objh] is available with NOT.
256
271
  if ret == true || ret == false
272
+ #; [!5y9iu] reports args and kwargs in error message.
273
+ s = __inspect_args_and_kwargs(args, kwargs)
257
274
  __assert(@bool == ret) {
258
- args = args.empty? ? '' : "(#{args.collect {|x| x.inspect }.join(', ')})"
259
275
  eq = @bool ? '' : ' == false'
260
- "$<actual>.#{method_name}#{args}#{eq}: failed.\n"\
276
+ "$<actual>.#{method_name}#{s}#{eq}: failed.\n"\
261
277
  " $<actual>: #{@actual.inspect}"
262
278
  }
263
279
  #; [!sljta] raises TypeError when boolean method returned non-boolean value.
@@ -267,6 +283,17 @@ module Oktest
267
283
  #; [!7bbrv] returns self when passed.
268
284
  self
269
285
  end
286
+ private :__method_missing
287
+
288
+ def __inspect_args_and_kwargs(args, kwargs)
289
+ kwargs ||= {}
290
+ arr = [
291
+ (args.empty? ? nil : args.collect {|x| x.inspect}),
292
+ (kwargs.empty? ? nil : kwargs.collect {|k, v| "#{k}: #{v.inspect}" }),
293
+ ].compact.flatten
294
+ return arr.empty? ? "" : "(#{arr.join(', ')})"
295
+ end
296
+ private :__inspect_args_and_kwargs
270
297
 
271
298
  def raise!(errcls=nil, errmsg=nil, &b)
272
299
  #; [!8k6ee] compares error class by '.is_a?' instead of '=='.
@@ -349,8 +376,8 @@ module Oktest
349
376
  #; [!vnc6b] sets exception object into '#exc' attribute.
350
377
  (class << proc_obj; self; end).class_eval { attr_accessor :exc }
351
378
  proc_obj.exc = exc
352
- #; [!y1b28] returns self when passed.
353
- self
379
+ #; [!y1b28] returns exception object.
380
+ return exc
354
381
  end
355
382
 
356
383
  def throw?(expected)
@@ -2310,7 +2337,7 @@ END
2310
2337
  @os_windows = RUBY_PLATFORM =~ /mswin|mingw/i
2311
2338
  @auto_run = true
2312
2339
  @ok_location = true # false will make 'ok()' faster
2313
- @color_available = ! @os_windows || ENV['COLORTERM'] =~ /color|24bit/i
2340
+ @color_available = ! @os_windows || ENV['WT_SESSION'] || ENV['COLORTERM'] =~ /color|24bit/i
2314
2341
  @color_enabled = @color_available && $stdout.tty?
2315
2342
  @diff_command = @os_windows ? "diff.exe -u" : "diff -u"
2316
2343
 
data/oktest.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
4
+ ### $Release: 1.3.0 $
5
5
  ### $License: MIT License $
6
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
6
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
7
7
  ###
8
8
 
9
9
  require 'rubygems'
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.name = "oktest"
14
14
  s.author = "kwatch"
15
15
  s.email = "kwatch@gmail.com"
16
- s.version = "$Release: 1.2.1 $".split()[1]
16
+ s.version = "$Release: 1.3.0 $".split()[1]
17
17
  s.license = "MIT"
18
18
  s.platform = Gem::Platform::RUBY
19
19
  s.homepage = "https://github.com/kwatch/oktest/tree/ruby"
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
@@ -351,7 +351,7 @@ END
351
351
  end
352
352
  end
353
353
 
354
- describe '#method_missing()' do
354
+ describe '#method_missing()' do
355
355
  it "[!7bbrv] returns self when passed." do
356
356
  should_return_self { ok {"file.png"}.end_with?(".png") }
357
357
  end
@@ -365,6 +365,27 @@ describe '#method_missing()' do
365
365
  ok {"a"}.start_with
366
366
  end
367
367
  end
368
+ it "[!gd3vg] supports keyword arguments on Ruby >= 2.7." do
369
+ #if RUBY_VERSION >= "2.7"
370
+ if true
371
+ eval <<-END
372
+ class Dummy392
373
+ def foo?(a, b, c: nil, d: nil)
374
+ return true
375
+ end
376
+ end
377
+ END
378
+ PASS! { ok {Dummy392.new}.foo?(123, 'abc', c: 45, d: true) }
379
+ if RUBY_VERSION >= "2.7"
380
+ errmsg = "unknown keywords: :x, :y"
381
+ else
382
+ errmsg = "unknown keywords: x, y"
383
+ end
384
+ ERROR!(ArgumentError, errmsg) do
385
+ ok {Dummy392.new}.foo?(123, 'abc', x: 45, y: true)
386
+ end
387
+ end
388
+ end
368
389
  it "[!f0ekh] skip top of backtrace when NoMethodError raised." do
369
390
  exc = ERROR!(NoMethodError) do
370
391
  ok {[1]}.start_with?(1)
@@ -399,12 +420,45 @@ describe '#method_missing()' do
399
420
  ok {s}.sos?
400
421
  end
401
422
  end
423
+ it "[!5y9iu] reports args and kwargs in error message." do
424
+ if RUBY_VERSION >= "2.7"
425
+ str = '123, "abc", x: "45", y: true'
426
+ else
427
+ str = '123, "abc", {:x=>"45", :y=>true}'
428
+ end
429
+ errmsg = "$<actual>.bla?(#{str}): failed.\n"\
430
+ " $<actual>: \"Blabla\""
431
+ FAIL!(errmsg) do
432
+ s = "Blabla"
433
+ def s.bla?(*a, **k); return false; end
434
+ ok {s}.bla?(123, "abc", x: "45", y: true)
435
+ end
436
+ #
437
+ obj = Oktest::AssertionObject.new(nil, true, nil)
438
+ expected = '(123, "abc", c: "45", d: true)'
439
+ actual = obj.instance_eval {
440
+ __inspect_args_and_kwargs([123, "abc"], c: "45", d: true)
441
+ }
442
+ assert_eq actual, expected
443
+ end
402
444
  end
403
445
 
404
446
  describe '#raise?' do
405
- it "[!y1b28] returns self when passed." do
447
+ it "[!y1b28] returns exception object." do
406
448
  pr = proc { "SOS".sos }
407
- should_return_self { ok {pr}.raise?(NoMethodError, "undefined method `sos' for \"SOS\":String") }
449
+ if RUBY_VERSION >= "3.3"
450
+ expected = "undefined method `sos' for an instance of String"
451
+ elsif RUBY_VERSION =~ /^3\.1\./
452
+ expected = "undefined method `sos' for \"SOS\":String\n"\
453
+ "\n"\
454
+ " pr = proc { \"SOS\".sos }\n"\
455
+ " ^^^^"
456
+ else
457
+ expected = "undefined method `sos' for \"SOS\":String"
458
+ end
459
+ ret = ok {pr}.raise?(NoMethodError, expected)
460
+ assert_eq ret.class, NoMethodError
461
+ assert_eq ret.message, expected
408
462
  end
409
463
  it "[!2rnni] 1st argument can be error message string or rexp." do
410
464
  pr = proc { raise "something wrong" }
@@ -440,14 +494,36 @@ describe '#method_missing()' do
440
494
  end
441
495
  it "[!4n3ed] reraises if exception is not matched to specified error class." do
442
496
  pr = proc { "SOS".sos }
443
- errmsg = "undefined method `sos' for \"SOS\":String"
497
+ if RUBY_VERSION >= "3.3"
498
+ errmsg = "undefined method `sos' for an instance of String"
499
+ elsif RUBY_VERSION =~ /^3\.1\./
500
+ errmsg = "undefined method `sos' for \"SOS\":String\n"\
501
+ "\n"\
502
+ " pr = proc { \"SOS\".sos }\n"\
503
+ " ^^^^"
504
+ else
505
+ errmsg = "undefined method `sos' for \"SOS\":String"
506
+ end
444
507
  ERROR!(NoMethodError, errmsg) { ok {pr}.raise?(ArgumentError) }
445
508
  end
446
509
  it "[!tpxlv] accepts string or regexp as error message." do
510
+ if RUBY_VERSION >= "3.1"
511
+ expected = "undefined method `sos' for \"SOS\":String\n"\
512
+ "\n"\
513
+ " pr = proc { \"SOS\".sos }\n"\
514
+ " ^^^^"
515
+ else
516
+ expected = "undefined method `sos' for \"SOS\":String"
517
+ end
447
518
  pr = proc { "SOS".sos }
448
- PASS! { ok {pr}.raise?(NoMethodError, "undefined method `sos' for \"SOS\":String") }
519
+ PASS! { ok {pr}.raise?(NoMethodError, ) }
449
520
  pr = proc { "SOS".sos }
450
- PASS! { ok {pr}.raise?(NoMethodError, /^undefined method `sos' for "SOS":String$/) }
521
+ if RUBY_VERSION >= "3.3"
522
+ expected = /^undefined method `sos' for an instance of String$/
523
+ else
524
+ expected = /^undefined method `sos' for "SOS":String$/
525
+ end
526
+ PASS! { ok {pr}.raise?(NoMethodError, expected) }
451
527
  end
452
528
  it "[!4c6x3] not check exception class when nil specified as errcls." do
453
529
  pr = proc { foobar() }
@@ -483,7 +559,16 @@ describe '#method_missing()' do
483
559
  end
484
560
  it "[!61vtv] assertion fails when specified exception raised." do
485
561
  pr = proc { "SOS".foobar }
486
- errmsg = "NoMethodError should not be raised but got #<NoMethodError: undefined method `foobar' for \"SOS\":String>."
562
+ if RUBY_VERSION >= "3.3"
563
+ errmsg = "NoMethodError should not be raised but got #<NoMethodError: undefined method `foobar' for an instance of String>."
564
+ elsif RUBY_VERSION =~ /^3\.1\./
565
+ errmsg = "NoMethodError should not be raised but got #<NoMethodError: undefined method `foobar' for \"SOS\":String\n"\
566
+ "\n"\
567
+ " pr = proc { \"SOS\".foobar }\n"\
568
+ " ^^^^^^^>."
569
+ else
570
+ errmsg = "NoMethodError should not be raised but got #<NoMethodError: undefined method `foobar' for \"SOS\":String>."
571
+ end
487
572
  FAIL!(errmsg) { ok {pr}.NOT.raise?(NoMethodError) }
488
573
  end
489
574
  it "[!smprc] compares error class with '==' operator, not '.is_a?'." do
@@ -516,7 +601,17 @@ describe '#method_missing()' do
516
601
  PASS! { ok {pr}.raise?(NoMethodError) }
517
602
  assert pr.respond_to?(:exc)
518
603
  assert pr.exc.is_a?(NoMethodError)
519
- assert_eq pr.exc.message, "undefined method `foobar' for \"SOS\":String"
604
+ if RUBY_VERSION >= "3.3"
605
+ errmsg = "undefined method `foobar' for an instance of String"
606
+ elsif RUBY_VERSION =~ /^3\.1\./
607
+ errmsg = "undefined method `foobar' for \"SOS\":String\n"\
608
+ "\n"\
609
+ " pr = proc { \"SOS\".foobar }\n"\
610
+ " ^^^^^^^"
611
+ else
612
+ errmsg = "undefined method `foobar' for \"SOS\":String"
613
+ end
614
+ assert_eq pr.exc.message, errmsg
520
615
  #
521
616
  pr = proc { nil }
522
617
  assert !pr.respond_to?(:exc)
data/test/filter_test.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
data/test/fixture_test.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
@@ -1,6 +1,6 @@
1
1
  ###
2
- ### $Release: 1.2.1 $
3
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
2
+ ### $Release: 1.3.0 $
3
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
4
4
  ### $License: MIT License $
5
5
  ###
6
6
 
data/test/helper_test.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  ###
2
- ### $Release: 1.2.1 $
3
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
2
+ ### $Release: 1.3.0 $
3
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
4
4
  ### $License: MIT License $
5
5
  ###
6
6
 
data/test/initialize.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
data/test/mainapp_test.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  ###
2
- ### $Release: 1.2.1 $
3
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
2
+ ### $Release: 1.3.0 $
3
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
4
4
  ### $License: MIT License $
5
5
  ###
6
6
 
@@ -257,7 +257,7 @@ END
257
257
  end
258
258
 
259
259
  it "[!qqizl] '--version' option prints version number." do
260
- expected = '$Release: 1.2.1 $'.split()[1] + "\n"
260
+ expected = '$Release: 1.3.0 $'.split()[1] + "\n"
261
261
  #
262
262
  ret, sout, serr = run("--version")
263
263
  assert_eq ret, 0
data/test/matcher_test.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
data/test/misc_test.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
data/test/node_test.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
data/test/runner_test.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
@@ -118,7 +118,24 @@ topic: "Parent"
118
118
  $<actual>: 2
119
119
  $<expected>: 1>
120
120
  spec: "spec#3"
121
+ END
122
+ if RUBY_VERSION >= "3.3"
123
+ expected += <<'END'
124
+ /spec: status=:ERROR, error=#<NoMethodError: undefined method `null?' for an instance of String>
125
+ END
126
+ elsif RUBY_VERSION =~ /^3\.1\./
127
+ expected += <<'END'
128
+ /spec: status=:ERROR, error=#<NoMethodError: undefined method `null?' for "":String
129
+
130
+ spec("spec#3") { "".null? } # error
131
+ ^^^^^^>
132
+ END
133
+ else
134
+ expected += <<'END'
121
135
  /spec: status=:ERROR, error=#<NoMethodError: undefined method `null?' for "":String>
136
+ END
137
+ end
138
+ expected += <<'END'
122
139
  spec: "spec#4"
123
140
  /spec: status=:SKIP, error=#<Oktest::SkipException: REASON>
124
141
  spec: "spec#5"
@@ -285,7 +302,24 @@ topic: "topic#A"
285
302
  /spec: status=:PASS
286
303
  spec: "spec#2"
287
304
  - at_end A2
305
+ END
306
+ if RUBY_VERSION >= "3.3"
307
+ expected += <<'END'
308
+ /spec: status=:ERROR, error=#<NoMethodError: undefined method `null?' for an instance of String>
309
+ END
310
+ elsif RUBY_VERSION =~ /^3\.1\./
311
+ expected += <<'END'
312
+ /spec: status=:ERROR, error=#<NoMethodError: undefined method `null?' for "":String
313
+
314
+ spec("spec#2") { at_end { puts " - at_end A2" }; "".null? } # raises NoMethodError
315
+ ^^^^^^>
316
+ END
317
+ else
318
+ expected += <<'END'
288
319
  /spec: status=:ERROR, error=#<NoMethodError: undefined method `null?' for "":String>
320
+ END
321
+ end
322
+ expected += <<'END'
289
323
  /topic
290
324
  /file
291
325
  END
data/test/tc.rb CHANGED
@@ -34,9 +34,9 @@ class TC
34
34
  obj.instance_eval(&b)
35
35
  rescue => exc
36
36
  if exc.is_a?(AssertionFailed)
37
- COUNTS[:fail] += 1; puts "FAILED!" unless ENV['TC_QUIET']
37
+ COUNTS[:fail] += 1; puts "\e[31mFAILED!\e[0m" unless ENV['TC_QUIET']
38
38
  else
39
- COUNTS[:error] += 1; puts "ERROR!" unless ENV['TC_QUIET']
39
+ COUNTS[:error] += 1; puts "\e[31mERROR!\e[0m" unless ENV['TC_QUIET']
40
40
  end
41
41
  puts " #{exc.class.name}: #{exc.message}"
42
42
  exc.backtrace.each do |bt|
data/test/util_test.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
data/test/visitor_test.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.2.1 $
5
- ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
4
+ ### $Release: 1.3.0 $
5
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
8
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oktest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kwatch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-30 00:00:00.000000000 Z
11
+ date: 2024-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubygems_version: 3.2.22
102
+ rubygems_version: 3.5.11
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: new style testing library