police-vminfo 0.0.3 → 0.0.4
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.
- data/VERSION +1 -1
- data/lib/police/vminfo/objects.rb +2 -0
- data/test/vminfo/objects_test.rb +21 -8
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
@@ -155,6 +155,7 @@ module VmInfo
|
|
155
155
|
methods = []
|
156
156
|
output.split("\n").each do |name|
|
157
157
|
method = module_or_class.instance_method name.to_sym
|
158
|
+
next unless method.owner == module_or_class
|
158
159
|
# TODO(pwnall): consider checking for re-defined core methods
|
159
160
|
methods << method
|
160
161
|
end
|
@@ -178,6 +179,7 @@ module VmInfo
|
|
178
179
|
singleton_class = module_or_class.singleton_class
|
179
180
|
output.split("\n").each do |name|
|
180
181
|
method = singleton_class.instance_method name.to_sym
|
182
|
+
next unless method.owner == singleton_class
|
181
183
|
# TODO(pwnall): consider checking for re-defined core methods
|
182
184
|
methods << method
|
183
185
|
end
|
data/test/vminfo/objects_test.rb
CHANGED
@@ -94,7 +94,7 @@ describe Police::VmInfo do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
it 'does not contain Bundler' do
|
97
|
-
result.wont_include Bundler
|
97
|
+
result.map(&:to_s).wont_include 'Bundler'
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -343,40 +343,53 @@ describe Police::VmInfo do
|
|
343
343
|
must_include :not_a_core_method
|
344
344
|
end
|
345
345
|
end
|
346
|
+
|
347
|
+
describe 'on IndexError' do
|
348
|
+
let(:methods) { Police::VmInfo.core_class_methods(IndexError) }
|
349
|
+
let(:method_names) { methods.map(&:name) }
|
350
|
+
|
351
|
+
it 'does not contain inherited class method exception' do
|
352
|
+
method_names.wont_include :exception
|
353
|
+
end
|
354
|
+
end
|
346
355
|
end
|
347
356
|
|
348
357
|
describe "#core_instance_methods" do
|
349
|
-
describe 'on
|
358
|
+
describe 'on String' do
|
350
359
|
before do
|
351
|
-
class
|
360
|
+
class String
|
352
361
|
def not_a_core_method
|
353
362
|
end
|
354
363
|
end
|
355
364
|
end
|
356
365
|
after do
|
357
|
-
class
|
366
|
+
class String
|
358
367
|
remove_method :not_a_core_method
|
359
368
|
end
|
360
369
|
end
|
361
370
|
|
362
|
-
let(:methods) { Police::VmInfo.core_instance_methods(
|
371
|
+
let(:methods) { Police::VmInfo.core_instance_methods(String) }
|
363
372
|
let(:method_names) { methods.map(&:name) }
|
364
373
|
|
365
374
|
it 'returns UnboundMethods' do
|
366
375
|
methods.each { |method| method.must_be_instance_of UnboundMethod }
|
367
376
|
end
|
368
377
|
|
369
|
-
it 'contains
|
370
|
-
method_names.must_include
|
378
|
+
it 'contains scan' do
|
379
|
+
method_names.must_include :scan
|
371
380
|
end
|
372
381
|
|
373
382
|
it 'does not contain not_a_core_method' do
|
374
383
|
method_names.wont_include :not_a_core_method
|
375
384
|
|
376
385
|
# Ensure that the test setup is correct.
|
377
|
-
Police::VmInfo.instance_methods(
|
386
|
+
Police::VmInfo.instance_methods(String).map(&:name).
|
378
387
|
must_include :not_a_core_method
|
379
388
|
end
|
389
|
+
|
390
|
+
it 'does not contain inherited instance method class' do
|
391
|
+
methods.wont_include :class
|
392
|
+
end
|
380
393
|
end
|
381
394
|
end
|
382
395
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: police-vminfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -51,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
segments:
|
53
53
|
- 0
|
54
|
-
hash:
|
54
|
+
hash: 3373141853385569443
|
55
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|