54 lines
1.9 KiB
Diff
54 lines
1.9 KiB
Diff
diff -Nur a/test/current_bindings_test.rb b/test/current_bindings_test.rb
|
|
--- a/test/current_bindings_test.rb 2022-01-26 10:31:50.154632034 +0800
|
|
+++ b/test/current_bindings_test.rb 2022-01-26 10:31:16.638078095 +0800
|
|
@@ -2,6 +2,8 @@
|
|
|
|
class CurrentBindingsTest < BaseTest
|
|
test 'first binding returned is the current one' do
|
|
- assert_equal __LINE__, Bindex.current_bindings.first.eval('__LINE__')
|
|
+ _, lineno = Bindex.current_bindings.first.source_location
|
|
+
|
|
+ assert_equal __LINE__ - 2, lineno
|
|
end
|
|
end
|
|
diff -Nur a/test/exception_test.rb b/test/exception_test.rb
|
|
--- a/test/exception_test.rb 2022-01-26 10:31:50.154632034 +0800
|
|
+++ b/test/exception_test.rb 2022-01-26 10:28:40.535498131 +0800
|
|
@@ -4,31 +4,31 @@
|
|
test 'bindings returns all the bindings of where the error originated' do
|
|
exc = FlatFixture.new.call
|
|
|
|
- assert_equal 3, exc.bindings.first.eval('__LINE__')
|
|
+ assert_equal 3, exc.bindings.first.source_location.last
|
|
end
|
|
|
|
test 'bindings returns all the bindings of where a custom error originate' do
|
|
exc = CustomErrorFixture.new.call
|
|
|
|
- assert_equal 5, exc.bindings.first.eval('__LINE__')
|
|
+ assert_equal 5, exc.bindings.first.source_location.last
|
|
end
|
|
|
|
test 'bindings goes down the_stack' do
|
|
exc = BasicNestedFixture.new.call
|
|
|
|
- assert_equal 11, exc.bindings.first.eval('__LINE__')
|
|
+ assert_equal 11, exc.bindings.first.source_location.last
|
|
end
|
|
|
|
test 'bindings inside_of_an_eval' do
|
|
exc = EvalNestedFixture.new.call
|
|
|
|
- assert_equal 11, exc.bindings.first.eval('__LINE__')
|
|
+ assert_equal 11, exc.bindings.first.source_location.last
|
|
end
|
|
|
|
test "re-raising doesn't lose bindings information" do
|
|
exc = ReraisedFixture.new.call
|
|
|
|
- assert_equal 3, exc.bindings.first.eval('__LINE__')
|
|
+ assert_equal 3, exc.bindings.first.source_location.last
|
|
end
|
|
|
|
test 'bindings is_empty_when_exception_is_still_not_raised' do
|