test-unit-ruby-core 1.0.5 → 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 +18 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d05dd3f2783ff27cdc3a1b49e882c6ee9f7b725f820fdbf5fe80411bf624042f
4
- data.tar.gz: c05744e10ee11583d7fb865af779e254a607a32a3ef06578ed2c88b68169bda0
3
+ metadata.gz: 512a8a8d90326adb03b0fcd934a862df0b7037dfd062c87bdc1b5dc5d6e55b40
4
+ data.tar.gz: 5b3e21b4585d358beaf305910adb69b7ec22bfa6a8cf7f8650a50aaaf4dfc806
5
5
  SHA512:
6
- metadata.gz: aff77d096a0e94695e3703c00e695c7e9a34e34d084cac2e4dc5eb133e8f542f7b89d91174366d403f6fe838568f18d123ef3e8e024c0cd0d68a39287bb51cae
7
- data.tar.gz: 8ba1b2d9f96b6f9f120afaf4265dd618e98a267bcd995881c78347d7c00fb98edd226b305de29d65c36c66b5ff878178a69e561dbaa2a9a0ec136e76727d3a86
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.5
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-24 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
@@ -44,8 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
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: []