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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/core_assertions.rb +8 -0
  3. data/lib/envutil.rb +26 -1
  4. metadata +19 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a463533f4ec5ea2d3b3d50aef4663ab7a746a548a020b284eba58214506a6ca3
4
- data.tar.gz: 900681b4f67b6cd195ad1ff8b54028007ce3b18c1a28634a06b6867164be3cc7
3
+ metadata.gz: 512a8a8d90326adb03b0fcd934a862df0b7037dfd062c87bdc1b5dc5d6e55b40
4
+ data.tar.gz: 5b3e21b4585d358beaf305910adb69b7ec22bfa6a8cf7f8650a50aaaf4dfc806
5
5
  SHA512:
6
- metadata.gz: 9bf3582d08879211053c48a11f604525585db0c6ad623820ed1e2ec113b52c856587cee0cc6c13b57e06ca771216182fec4fd58b8b4ab4308dad266e26904896
7
- data.tar.gz: 5dbbdd66fced6282e39f84cdd79f44fefa824351106f6a652b9db79be2d790a09c68493f847dc26d3f54ef0ad4fcd4a6cc7874fe98e92a6c471c978ae2f9c173
6
+ metadata.gz: a2ebf8ab00608dfe120e13375869b396ee3b12b4d6430c8dfd991fd625896a925c92b9d5989111f5d88054429b1ce317ed358376a605491b38921f62bbebbe8d
7
+ data.tar.gz: db528053eefa1e8ea88517e1c1981bf326e298faf1f04917c3677ed64e7ee136c88dc9be4b715706fedba67b8d6967f80f98530ee1d585312dae82d2c5a0e84d
@@ -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 = defined?(Warning.[]) ? %i[deprecated experimental].to_h {|i| [i, Warning[i]]} : nil
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
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: 2023-10-20 00:00:00.000000000 Z
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.4'
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.5.0.dev
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: []