test-unit-ruby-core 1.0.11 → 1.0.13
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 +4 -4
- data/lib/core_assertions.rb +32 -11
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 29365462eba565b84ef3473c3ac7a3bf2411c0b537a292eaf28a33329e69d746
|
|
4
|
+
data.tar.gz: ffa994c78613ee85efc4b35e8c3b418b5fe8e9258204d57f787068fade7ec7b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cc85ccee8dfefe70ea01e6167d8e73b4d4ef0dced1239e5d066812052f9f468a451fedc3cf26ae1289d147d96cd4e2c57c536c8b0661bbf915863882758a953e
|
|
7
|
+
data.tar.gz: 83f4fb10dd0c64bae14aafc5f700f36fce22d39ea6cc152a8dec15fa8b673a6704863dd607cc103175f0ec8bf41ef6e16b28ba6351886c2a7cd5131345109ae3
|
data/lib/core_assertions.rb
CHANGED
|
@@ -75,9 +75,18 @@ module Test
|
|
|
75
75
|
require_relative 'envutil'
|
|
76
76
|
require 'pp'
|
|
77
77
|
begin
|
|
78
|
-
require '-test-/
|
|
78
|
+
require '-test-/sanitizers'
|
|
79
79
|
rescue LoadError
|
|
80
|
+
# in test-unit-ruby-core gem
|
|
81
|
+
def sanitizers
|
|
82
|
+
nil
|
|
83
|
+
end
|
|
84
|
+
else
|
|
85
|
+
def sanitizers
|
|
86
|
+
Test::Sanitizers
|
|
87
|
+
end
|
|
80
88
|
end
|
|
89
|
+
module_function :sanitizers
|
|
81
90
|
|
|
82
91
|
nil.pretty_inspect
|
|
83
92
|
|
|
@@ -97,9 +106,11 @@ module Test
|
|
|
97
106
|
end
|
|
98
107
|
|
|
99
108
|
def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil,
|
|
100
|
-
success: nil, failed: nil, **opt)
|
|
109
|
+
success: nil, failed: nil, gems: false, **opt)
|
|
101
110
|
args = Array(args).dup
|
|
102
|
-
|
|
111
|
+
unless gems.nil?
|
|
112
|
+
args.insert((Hash === args[0] ? 1 : 0), "--#{gems ? 'enable' : 'disable'}=gems")
|
|
113
|
+
end
|
|
103
114
|
stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, **opt)
|
|
104
115
|
desc = failed[status, message, stderr] if failed
|
|
105
116
|
desc ||= FailDesc[status, message, stderr]
|
|
@@ -160,7 +171,7 @@ module Test
|
|
|
160
171
|
pend 'assert_no_memory_leak may consider MJIT memory usage as leak' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
|
|
161
172
|
# ASAN has the same problem - its shadow memory greatly increases memory usage
|
|
162
173
|
# (plus asan has better ways to detect memory leaks than this assertion)
|
|
163
|
-
pend 'assert_no_memory_leak may consider ASAN memory usage as leak' if
|
|
174
|
+
pend 'assert_no_memory_leak may consider ASAN memory usage as leak' if sanitizers&.asan_enabled?
|
|
164
175
|
|
|
165
176
|
require_relative 'memory_status'
|
|
166
177
|
raise Test::Unit::PendedError, "unsupported platform" unless defined?(Memory::Status)
|
|
@@ -328,7 +339,16 @@ eom
|
|
|
328
339
|
args = args.dup
|
|
329
340
|
args.insert((Hash === args.first ? 1 : 0), "-w", "--disable=gems", *$:.map {|l| "-I#{l}"})
|
|
330
341
|
args << "--debug" if RUBY_ENGINE == 'jruby' # warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
|
|
342
|
+
# power_assert 3 requires ruby 3.1 or later
|
|
343
|
+
args << "-W:no-experimental" if RUBY_VERSION < "3.1."
|
|
331
344
|
stdout, stderr, status = EnvUtil.invoke_ruby(args, src, capture_stdout, true, **opt)
|
|
345
|
+
|
|
346
|
+
if sanitizers&.lsan_enabled?
|
|
347
|
+
# LSAN may output messages like the following line into stderr. We should ignore it.
|
|
348
|
+
# ==276855==Running thread 276851 was not suspended. False leaks are possible.
|
|
349
|
+
# See https://github.com/google/sanitizers/issues/1479
|
|
350
|
+
stderr.gsub!(/==\d+==Running thread \d+ was not suspended\. False leaks are possible\.\n/, "")
|
|
351
|
+
end
|
|
332
352
|
ensure
|
|
333
353
|
if res_c
|
|
334
354
|
res_c.close
|
|
@@ -376,7 +396,11 @@ eom
|
|
|
376
396
|
shim_value = "class Ractor; alias value take; end" unless Ractor.method_defined?(:value)
|
|
377
397
|
shim_join = "class Ractor; alias join take; end" unless Ractor.method_defined?(:join)
|
|
378
398
|
|
|
379
|
-
|
|
399
|
+
if require
|
|
400
|
+
require = [require] unless require.is_a?(Array)
|
|
401
|
+
require = require.map {|r| "require #{r.inspect}"}.join("\n")
|
|
402
|
+
end
|
|
403
|
+
|
|
380
404
|
if require_relative
|
|
381
405
|
dir = File.dirname(caller_locations[0,1][0].absolute_path)
|
|
382
406
|
full_path = File.expand_path(require_relative, dir)
|
|
@@ -501,13 +525,10 @@ eom
|
|
|
501
525
|
assert = :assert_match
|
|
502
526
|
end
|
|
503
527
|
|
|
504
|
-
ex =
|
|
505
|
-
|
|
506
|
-
ex = assert_raise(exception, msg || proc {"Exception(#{exception}) with message matches to #{expected.inspect}"}) do
|
|
507
|
-
yield
|
|
508
|
-
end
|
|
509
|
-
m = ex.message
|
|
528
|
+
ex = assert_raise(exception, msg || proc {"Exception(#{exception}) with message matches to #{expected.inspect}"}) do
|
|
529
|
+
yield
|
|
510
530
|
end
|
|
531
|
+
m = ex.message
|
|
511
532
|
msg = message(msg, "") {"Expected Exception(#{exception}) was raised, but the message doesn't match"}
|
|
512
533
|
|
|
513
534
|
if assert == :assert_equal
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: test-unit-ruby-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hiroshi SHIBATA
|
|
8
8
|
- Nobu Nakada
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-unit
|