bindex 0.1.0 → 0.1.1
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/bindex/rubinius.rb +18 -8
- data/lib/bindex/version.rb +1 -1
- data/test/exception_test.rb +6 -0
- data/test/fixtures/reraised_fixture.rb +19 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f3058f9c6ca15bbd05c8857a4c13b931c10855c
|
4
|
+
data.tar.gz: b0dc1e2b67f95cd838f427a11c03608161c03cd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3be4c3659396f2e68c9c3526bc5bd9c8e69325babb902d7bc4e0977bcf3c4b842e8c11a54af00169b926135672e28f836a4b41c88bfaa16b870ca010e41a47f2
|
7
|
+
data.tar.gz: f0a5337d9a0b35729f44b2d162e1c1e7028f147eaacfd270c10592e0ef8fd2d6f7bf7cf6ad1ef0e233c46b8379707cc06a2074956f6a74ab24b7f3dac1b34d3b
|
data/lib/bindex/rubinius.rb
CHANGED
@@ -19,13 +19,18 @@ module Bindex
|
|
19
19
|
|
20
20
|
# Filters internal Rubinius locations.
|
21
21
|
#
|
22
|
-
#
|
23
|
-
# implemented in Ruby for Rubinius. Therefore, we will get a binding for
|
24
|
-
# them as well.
|
22
|
+
# There are a couple of reasons why we wanna filter out the locations.
|
25
23
|
#
|
26
|
-
#
|
27
|
-
# the
|
28
|
-
#
|
24
|
+
# * ::Kernel.raise, is implemented in Ruby for Rubinius. We don't wanna
|
25
|
+
# have the frame for it to align with the CRuby and JRuby implementations.
|
26
|
+
#
|
27
|
+
# * For internal methods location variables can be nil. We can't create a
|
28
|
+
# bindings for them.
|
29
|
+
#
|
30
|
+
# * Bindings from the current file are considered internal and ignored.
|
31
|
+
#
|
32
|
+
# We do that all that so we can align the bindings with the backtraces
|
33
|
+
# entries.
|
29
34
|
class InternalLocationFilter
|
30
35
|
def initialize(locations)
|
31
36
|
@locations = locations
|
@@ -33,7 +38,9 @@ module Bindex
|
|
33
38
|
|
34
39
|
def filter
|
35
40
|
@locations.reject do |location|
|
36
|
-
location.file.start_with?('kernel/') ||
|
41
|
+
location.file.start_with?('kernel/delta/kernel.rb') ||
|
42
|
+
location.file == __FILE__ ||
|
43
|
+
location.variables.nil?
|
37
44
|
end
|
38
45
|
end
|
39
46
|
end
|
@@ -50,7 +57,10 @@ end
|
|
50
57
|
raise_exception = instance_method(:raise_exception)
|
51
58
|
|
52
59
|
define_method(:raise_exception) do |exc|
|
53
|
-
exc.
|
60
|
+
if exc.bindings.empty?
|
61
|
+
exc.instance_variable_set(:@bindings, Bindex::Rubinius.current_bindings)
|
62
|
+
end
|
63
|
+
|
54
64
|
raise_exception.bind(self).call(exc)
|
55
65
|
end
|
56
66
|
end
|
data/lib/bindex/version.rb
CHANGED
data/test/exception_test.rb
CHANGED
@@ -25,6 +25,12 @@ class ExceptionTest < BaseTest
|
|
25
25
|
assert_equal 11, exc.bindings.first.eval('__LINE__')
|
26
26
|
end
|
27
27
|
|
28
|
+
test "re-raising doesn't lose bindings information" do
|
29
|
+
exc = ReraisedFixture.new.call
|
30
|
+
|
31
|
+
assert_equal 3, exc.bindings.first.eval('__LINE__')
|
32
|
+
end
|
33
|
+
|
28
34
|
test 'bindings is_empty_when_exception_is_still_not_raised' do
|
29
35
|
exc = RuntimeError.new
|
30
36
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bindex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genadi Samokovarov
|
@@ -236,6 +236,7 @@ files:
|
|
236
236
|
- test/fixtures/custom_error_fixture.rb
|
237
237
|
- test/fixtures/eval_nested_fixture.rb
|
238
238
|
- test/fixtures/flat_fixture.rb
|
239
|
+
- test/fixtures/reraised_fixture.rb
|
239
240
|
- test/test_helper.rb
|
240
241
|
homepage: https://github.com/gsamokovarov/bindex
|
241
242
|
licenses:
|
@@ -267,4 +268,5 @@ test_files:
|
|
267
268
|
- test/fixtures/custom_error_fixture.rb
|
268
269
|
- test/fixtures/eval_nested_fixture.rb
|
269
270
|
- test/fixtures/flat_fixture.rb
|
271
|
+
- test/fixtures/reraised_fixture.rb
|
270
272
|
- test/test_helper.rb
|