Fix nil error with KNOWNBUGS.rb

Previously, `make test-knownbugs` crashed with `NoMethodError` due to
the failed regex match if there is a test case in KNOWNBUGS.rb.

The note about 1.8 compatibility is probably bogus as we require a way
more recent BASERUBY now.
This commit is contained in:
Alan Wu 2024-04-08 12:31:33 -04:00 committed by GitHub
parent 00cbdb5a8b
commit 478b4ef9de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,7 +6,6 @@
# Never use optparse in this file.
# Never use test/unit in this file.
# Never use Ruby extensions in this file.
# Maintain Ruby 1.8 compatibility for now
$start_time = Time.now
@ -428,7 +427,7 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc)
def initialize(*args)
super
self.class.add self
@category = self.path.match(/test_(.+)\.rb/)[1]
@category = self.path[/\Atest_(.+)\.rb\z/, 1]
end
def call