test-unit-ruby-core 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/core_assertions.rb +8 -0
- data/lib/envutil.rb +26 -1
- metadata +19 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 512a8a8d90326adb03b0fcd934a862df0b7037dfd062c87bdc1b5dc5d6e55b40
|
4
|
+
data.tar.gz: 5b3e21b4585d358beaf305910adb69b7ec22bfa6a8cf7f8650a50aaaf4dfc806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2ebf8ab00608dfe120e13375869b396ee3b12b4d6430c8dfd991fd625896a925c92b9d5989111f5d88054429b1ce317ed358376a605491b38921f62bbebbe8d
|
7
|
+
data.tar.gz: db528053eefa1e8ea88517e1c1981bf326e298faf1f04917c3677ed64e7ee136c88dc9be4b715706fedba67b8d6967f80f98530ee1d585312dae82d2c5a0e84d
|
data/lib/core_assertions.rb
CHANGED
@@ -74,6 +74,11 @@ module Test
|
|
74
74
|
module CoreAssertions
|
75
75
|
require_relative 'envutil'
|
76
76
|
require 'pp'
|
77
|
+
begin
|
78
|
+
require '-test-/asan'
|
79
|
+
rescue LoadError
|
80
|
+
end
|
81
|
+
|
77
82
|
nil.pretty_inspect
|
78
83
|
|
79
84
|
def mu_pp(obj) #:nodoc:
|
@@ -152,6 +157,9 @@ module Test
|
|
152
157
|
pend 'assert_no_memory_leak may consider RJIT memory usage as leak' if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled?
|
153
158
|
# For previous versions which implemented MJIT
|
154
159
|
pend 'assert_no_memory_leak may consider MJIT memory usage as leak' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
|
160
|
+
# ASAN has the same problem - its shadow memory greatly increases memory usage
|
161
|
+
# (plus asan has better ways to detect memory leaks than this assertion)
|
162
|
+
pend 'assert_no_memory_leak may consider ASAN memory usage as leak' if defined?(Test::ASAN) && Test::ASAN.enabled?
|
155
163
|
|
156
164
|
require_relative 'memory_status'
|
157
165
|
raise Test::Unit::PendedError, "unsupported platform" unless defined?(Memory::Status)
|
data/lib/envutil.rb
CHANGED
@@ -52,7 +52,14 @@ module EnvUtil
|
|
52
52
|
@original_internal_encoding = Encoding.default_internal
|
53
53
|
@original_external_encoding = Encoding.default_external
|
54
54
|
@original_verbose = $VERBOSE
|
55
|
-
@original_warning =
|
55
|
+
@original_warning =
|
56
|
+
if defined?(Warning.categories)
|
57
|
+
Warning.categories.to_h {|i| [i, Warning[i]]}
|
58
|
+
elsif defined?(Warning.[]) # 2.7+
|
59
|
+
%i[deprecated experimental performance].to_h do |i|
|
60
|
+
[i, begin Warning[i]; rescue ArgumentError; end]
|
61
|
+
end.compact
|
62
|
+
end
|
56
63
|
end
|
57
64
|
end
|
58
65
|
|
@@ -245,6 +252,24 @@ module EnvUtil
|
|
245
252
|
end
|
246
253
|
module_function :under_gc_stress
|
247
254
|
|
255
|
+
def under_gc_compact_stress(val = :empty, &block)
|
256
|
+
raise "compaction doesn't work well on s390x. Omit the test in the caller." if RUBY_PLATFORM =~ /s390x/ # https://github.com/ruby/ruby/pull/5077
|
257
|
+
auto_compact = GC.auto_compact
|
258
|
+
GC.auto_compact = val
|
259
|
+
under_gc_stress(&block)
|
260
|
+
ensure
|
261
|
+
GC.auto_compact = auto_compact
|
262
|
+
end
|
263
|
+
module_function :under_gc_compact_stress
|
264
|
+
|
265
|
+
def without_gc
|
266
|
+
prev_disabled = GC.disable
|
267
|
+
yield
|
268
|
+
ensure
|
269
|
+
GC.enable unless prev_disabled
|
270
|
+
end
|
271
|
+
module_function :without_gc
|
272
|
+
|
248
273
|
def with_default_external(enc)
|
249
274
|
suppress_warning { Encoding.default_external = enc }
|
250
275
|
yield
|
metadata
CHANGED
@@ -1,16 +1,29 @@
|
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi SHIBATA
|
8
8
|
- Nobu Nakada
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
11
|
+
date: 2024-05-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: test-unit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
14
27
|
description: Additional test assertions for Ruby standard libraries.
|
15
28
|
email:
|
16
29
|
- hsbt@ruby-lang.org
|
@@ -29,7 +42,6 @@ licenses:
|
|
29
42
|
metadata:
|
30
43
|
homepage_uri: https://github.com/ruby/test-unit-ruby-core
|
31
44
|
source_code_uri: https://github.com/ruby/test-unit-ruby-core
|
32
|
-
post_install_message:
|
33
45
|
rdoc_options: []
|
34
46
|
require_paths:
|
35
47
|
- lib
|
@@ -37,15 +49,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
37
49
|
requirements:
|
38
50
|
- - ">="
|
39
51
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
52
|
+
version: '2.3'
|
41
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
54
|
requirements:
|
43
55
|
- - ">="
|
44
56
|
- !ruby/object:Gem::Version
|
45
57
|
version: '0'
|
46
58
|
requirements: []
|
47
|
-
rubygems_version: 3.
|
48
|
-
signing_key:
|
59
|
+
rubygems_version: 3.6.0.dev
|
49
60
|
specification_version: 4
|
50
61
|
summary: Additional test assertions for Ruby standard libraries.
|
51
62
|
test_files: []
|