Skip to content

Instantly share code, notes, and snippets.

View zenspider's full-sized avatar
🌈
It's complicated?

Ryan Davis zenspider

🌈
It's complicated?
View GitHub Profile
# NOTE: ironically, this breaks if using Werror + frozen-string-literals
def summary # :nodoc:
extra = ""
extra = "\n\nYou have skipped tests. Run with --verbose for details." if
results.any?(&:skipped?) unless
options[:verbose] or options[:show_skips] or ENV["MT_NO_SKIP_MSG"]
extra.prepend ", %d warnings" % [warnings] if options[:Werror]
diff -r old/lib/minitest.rb new/lib/minitest.rb
--- old/lib/minitest.rb
+++ new/lib/minitest.rb
@@ -99,12 +99,10 @@
end
def self.load_plugins # :nodoc:
- return unless self.extensions.empty?
+ return unless defined? Gem
+ Added -Werror to raise on any warning output. (byroot)
Also allows for -Wall or -W or -W<category>.
+ Added UnexpectedWarning as a failure summary type, added count to output if activated.
Fixed all tests to pass vanilla + -Werror.
Found (but not yet fixed) tests that currently fail vanilla if `$-w=nil`.
--- /dev/null 2024-05-12 01:05:47
+++ ./lib/minitest/error_on_warning.rb 2024-05-10 14:07:17
@@ -0,0 +1,11 @@
@zenspider
zenspider / minitest_manual_plugins.rb
Last active May 3, 2024 19:34
minitest/manual_plugins
#!/usr/bin/env ruby -w
$:.unshift "lib"
$: << "../../minitest-gcstats/dev/lib"
############################################################
## minitest/manual_plugins.rb
require "minitest"
diff -r old/lib/minitest.rb new/lib/minitest.rb
--- old/lib/minitest.rb
+++ new/lib/minitest.rb
@@ -164,11 +164,33 @@
warn "Interrupted. Exiting..."
end
self.parallel_executor.shutdown
+
+ # might have been removed/replaced during init_plugins:
+ summary = reporter.reporters.grep(SummaryReporter).first
10422 % ruby -Ilib kaboom.rb
Run options: --seed 39367
# Running:
E
Finished in 0.094671s, 10.5629 runs/s, 0.0000 assertions/s.
1) Error:

sudo nice -20

8710 % sudo nice -n -20 ./qb.rb
Calculating -------------------------------------
          caller_old     93.921k (± 0.4%) i/s -    473.433k in   5.040798s
          caller_new     95.918k (± 5.7%) i/s -    480.935k in   5.035228s
         caller_new2    104.619k (± 0.3%) i/s -    528.462k in   5.051375s
caller_locations_old    124.798k (± 0.2%) i/s -    625.185k in   5.009594s
caller_locations_new    125.252k (± 0.8%) i/s -    630.288k in   5.032480s
caller_locations_new2   140.866k (± 0.2%) i/s -    705.888k in   5.011073s
+ Output relative path:line where possible, absolute otherwise.
- BacktraceFilter#filter can now work with caller_locations.
diff -r old/lib/minitest.rb new/lib/minitest.rb
--- old/lib/minitest.rb
+++ new/lib/minitest.rb
@@ -523,12 +523,14 @@
not self.failure
end
diff -r old/lib/minitest.rb new/lib/minitest.rb
--- old/lib/minitest.rb
+++ new/lib/minitest.rb
--- /tmp/tmp.99247.0x2055f8280.49 2023-07-20 11:24:53
+++ /Users/ryan/Work/p4/zss/src/minitest/dev/lib/minitest.rb 2023-07-20 11:12:35
@@ -446,6 +446,31 @@
self.name = name
self.failures = []
self.assertions = 0
+ # lazy initializer for metadata
class CompressedSystemStackError < StandardError # NOT SystemStackError
def self.raise_from sse
raise CompressedSystemStackError, sse.message, compress(sse.backtrace)
end
##
# Compress an array of strings by finding cycles within and
# reformatting them.
# ---
# FFS this is an unreadable mess. Please forgive, I didn't want to