Last active
August 29, 2024 07:30
-
-
Save zenspider/7f7d7f8d8bfff01fd4a09f026fb99a9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r old/lib/minitest.rb new/lib/minitest.rb | |
--- old/lib/minitest.rb | |
+++ new/lib/minitest.rb | |
@@ -647,7 +647,7 @@ | |
## | |
# The location of the test method. | |
- attr_accessor :source_location | |
+ attr_writer :source_location | |
## | |
# Create a new test result from a Runnable instance. | |
@@ -658,15 +658,22 @@ | |
r = self.new o.name | |
r.klass = o.class.name | |
r.assertions = o.assertions | |
- r.failures = o.failures.dup | |
+ r.failures = o.failures | |
r.time = o.time | |
r.metadata = o.metadata if o.metadata? | |
- r.source_location = o.method(o.name).source_location rescue ["unknown", -1] | |
+ r.source_location = o.method(o.name).source_location unless runnable.passed? | |
r | |
end | |
+ ## | |
+ # The location of the test method. | |
+ | |
+ def source_location | |
+ @source_location ||= ["unknown", -1] | |
+ end | |
+ | |
def class_name # :nodoc: | |
self.klass # for Minitest::Reportable | |
end | |
diff -r old/test/minitest/test_minitest_test.rb new/test/minitest/test_minitest_test.rb | |
--- old/test/minitest/test_minitest_test.rb | |
+++ new/test/minitest/test_minitest_test.rb | |
@@ -782,6 +782,10 @@ | |
tc.assertions = 42 | |
tc.failures << "a failure" | |
+ def tc.passed? | |
+ false | |
+ end | |
+ | |
yield tc if block_given? | |
def tc.setup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment