From d7c50afae90eded4927e29002e3967a2362bd7d1 Mon Sep 17 00:00:00 2001 From: lyn1001 Date: Wed, 26 Jan 2022 10:53:18 +0800 Subject: [PATCH] Fix test error --- Fix-test-error.patch | 53 ++++++++++++++++++++++++++++++++++++++++++++ rubygem-bindex.spec | 7 +++++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 Fix-test-error.patch diff --git a/Fix-test-error.patch b/Fix-test-error.patch new file mode 100644 index 0000000..3a9b328 --- /dev/null +++ b/Fix-test-error.patch @@ -0,0 +1,53 @@ +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 diff --git a/rubygem-bindex.spec b/rubygem-bindex.spec index 70065bf..35de45f 100644 --- a/rubygem-bindex.spec +++ b/rubygem-bindex.spec @@ -1,11 +1,12 @@ %global gem_name bindex Name: rubygem-%{gem_name} Version: 0.5.0 -Release: 1 +Release: 2 Summary: Bindings for your Ruby exceptions License: MIT URL: https://github.com/gsamokovarov/bindex Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem +Patch0: Fix-test-error.patch BuildRequires: ruby(release) rubygems-devel ruby-devel >= 2.0.0 gcc rubygem(minitest) %description Bindings for your Ruby exceptions. @@ -22,6 +23,7 @@ Documentation for %{name}. %prep gem unpack %{SOURCE0} %setup -q -D -T -n %{gem_name}-%{version} +%patch0 -p1 gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec %build @@ -62,5 +64,8 @@ popd %{gem_instdir}/test %changelog +* Wed Jan 26 2022 liyanan - 0.5.0-2 +- Fix test error + * Mon Aug 24 2020 liyanan - 0.5.0-1 - package init