test-unit-ruby-core 1.0.12 → 1.0.14
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 +30 -13
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b1a6b243df63415aab0c4d40274b847b50f386b16bd422a88b26ee788559f547
|
|
4
|
+
data.tar.gz: 7d216b5c7c53872f9c50c5b425ecda7b467e4e09ff0e86743288cbfe492f6548
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee5b3f46d0cdab4dfc899b280980e78a2d394af4134756ca8bad77d620cf857aeaa5e576cda72fc30baeeddfcca064f20c21fdaf895f141f60a96aae7fac7209
|
|
7
|
+
data.tar.gz: '0593598f1f9f1756ab80fb9121dd230951d88a7fc3de06ab333b651a99fb42ccb188e19f138c1e014893b4f513409fcc7f9bca079c3308c7e2a5ab9ce998510a'
|
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,9 +339,14 @@ 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
|
|
331
|
-
# power_assert 3 requires ruby 3.1 or later
|
|
332
|
-
args << "-W:no-experimental" if RUBY_VERSION < "3.1."
|
|
333
342
|
stdout, stderr, status = EnvUtil.invoke_ruby(args, src, capture_stdout, true, **opt)
|
|
343
|
+
|
|
344
|
+
if sanitizers&.lsan_enabled?
|
|
345
|
+
# LSAN may output messages like the following line into stderr. We should ignore it.
|
|
346
|
+
# ==276855==Running thread 276851 was not suspended. False leaks are possible.
|
|
347
|
+
# See https://github.com/google/sanitizers/issues/1479
|
|
348
|
+
stderr.gsub!(/==\d+==Running thread \d+ was not suspended\. False leaks are possible\.\n/, "")
|
|
349
|
+
end
|
|
334
350
|
ensure
|
|
335
351
|
if res_c
|
|
336
352
|
res_c.close
|
|
@@ -378,7 +394,11 @@ eom
|
|
|
378
394
|
shim_value = "class Ractor; alias value take; end" unless Ractor.method_defined?(:value)
|
|
379
395
|
shim_join = "class Ractor; alias join take; end" unless Ractor.method_defined?(:join)
|
|
380
396
|
|
|
381
|
-
|
|
397
|
+
if require
|
|
398
|
+
require = [require] unless require.is_a?(Array)
|
|
399
|
+
require = require.map {|r| "require #{r.inspect}"}.join("\n")
|
|
400
|
+
end
|
|
401
|
+
|
|
382
402
|
if require_relative
|
|
383
403
|
dir = File.dirname(caller_locations[0,1][0].absolute_path)
|
|
384
404
|
full_path = File.expand_path(require_relative, dir)
|
|
@@ -503,13 +523,10 @@ eom
|
|
|
503
523
|
assert = :assert_match
|
|
504
524
|
end
|
|
505
525
|
|
|
506
|
-
ex =
|
|
507
|
-
|
|
508
|
-
ex = assert_raise(exception, msg || proc {"Exception(#{exception}) with message matches to #{expected.inspect}"}) do
|
|
509
|
-
yield
|
|
510
|
-
end
|
|
511
|
-
m = ex.message
|
|
526
|
+
ex = assert_raise(exception, msg || proc {"Exception(#{exception}) with message matches to #{expected.inspect}"}) do
|
|
527
|
+
yield
|
|
512
528
|
end
|
|
529
|
+
m = ex.message
|
|
513
530
|
msg = message(msg, "") {"Expected Exception(#{exception}) was raised, but the message doesn't match"}
|
|
514
531
|
|
|
515
532
|
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.14
|
|
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-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-unit
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 3.7.2
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 3.7.2
|
|
27
27
|
description: Additional test assertions for Ruby standard libraries.
|
|
28
28
|
email:
|
|
29
29
|
- hsbt@ruby-lang.org
|