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
#!/usr/bin/ruby -w
$: << "../../sexp_processor/dev/lib"
$: << "lib"
require "ruby_parser"
require "sexp_processor"
require "set"
+ 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

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
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:
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
@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"
+ 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 @@
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
# 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/rake_reporter.rb new/lib/minitest/rake_reporter.rb
--- old/lib/minitest/rake_reporter.rb
+++ new/lib/minitest/rake_reporter.rb
@@ -2,9 +2,16 @@
module Minitest
class RakeReporter < SprintReporter
+ attr_accessor :name
+
+ def initialize name = nil