This file contains hidden or 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
| self.post_install_message = <<~EOM | |
| NOTE: minitest 5 will be the last in the minitest family to support | |
| ruby 1.8 to 2.7. If you need to keep using these versions, | |
| you need to pin your dependency to minitest with something | |
| like "~> 5.0". See History.rdoc to locate compatible | |
| versions. | |
| Further, minitest 6 will be dropping the following: | |
| + MiniTest (it's been Minitest for *years*) |
This file contains hidden or 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
| ERR_RE = /unexpected (?:end-of-input|\$end|end-of-file|END_OF_FILE)|embedded document meets end of file|unterminated (?:string|regexp|list) meets end of file/.freeze | |
| def self.complete_expression?(str) | |
| catch(:valid) do | |
| eval("BEGIN{throw :valid}\n#{str}") | |
| end | |
| true | |
| rescue SyntaxError => ex | |
| if ENV["FASTER"] then | |
| msg = ex.message |
This file contains hidden or 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
| at_exit { exit Mini.autotest } | |
| module Mini | |
| def self.all_tests = Test.subklasses.flat_map { |k| k.tests.map { |m| [k, m] } } | |
| def self.autotest = all_tests.shuffle.count { |k, m| k.run m }.zero? | |
| class Test | |
| @@subklasses = [] | |
| def self.subklasses = @@subklasses | |
| def self.inherited(k) = subklasses << k |
This file contains hidden or 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 | |
| @@ -36,7 +36,7 @@ | |
| warn "DEPRECATED: use MT_CPU instead of N for parallel test runs" if ENV["N"] && ENV["N"].to_i > 0 | |
| n_threads = (ENV["MT_CPU"] || ENV["N"] || Etc.nprocessors).to_i | |
| - self.parallel_executor = Parallel::Executor.new n_threads | |
| + self.parallel_executor = Parallel::Executor.new n_threads if n_threads > 1 | |
This file contains hidden or 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
| modified lib/minitest.rb | |
| @@ -185,6 +185,10 @@ module Minitest | |
| options[:show_skips] = true | |
| end | |
| + opts.on "--hard-mode", "Run tests in 'hard mode', aka fully random." do | |
| + options[:hard_mode] = true | |
| + end | |
| + | |
| opts.on "-n", "--name PATTERN", "Filter run on /regexp/ or string." do |a| |
This file contains hidden or 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
| # which one do I hate least and why? | |
| ban, = db.execute(<<~SQL, ip:, jail:, offset:) # parens, anti-seattle.rb style | |
| ban, = db.execute <<~SQL, {ip:, jail:, offset:} # braces, same | |
| ban, = db.execute <<~SQL, ip:, jail:, offset:offset # one value, to prevent hanging: | |
| ban, = db.execute <<~SQL, ip:ip, jail:jail, offset:offset # consistent, but long | |
| ban, = db.execute <<~SQL, ip:, jail:, offset:; # you monster version |
This file contains hidden or 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
| #!/usr/bin/env -S ruby -w | |
| $: << File.expand_path("~/Links/RI/lib") | |
| $: << File.expand_path("~/Links/ZT/lib") | |
| require "rubygems" | |
| require "inline" | |
| class X | |
| inline :C do |builder| |
This file contains hidden or 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
| 10000 $ ./diffdump 'def a(...); b(...); end' 'def a(x, ...); b(...); end' | |
| --- /dev/fd/63 2025-05-10 14:00:39 | |
| +++ /dev/fd/62 2025-05-10 14:00:39 | |
| @@ -1,12 +1,17 @@ | |
| -== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,23)> | |
| +== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,26)> | |
| 0000 definemethod :a, a ( 1)[Li] | |
| 0003 putobject :a | |
| 0005 leave | |
This file contains hidden or 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
| --- /dev/fd/63 2025-05-08 15:52:58 | |
| +++ /dev/fd/62 2025-05-08 15:52:58 | |
| @@ -1,14 +1,19 @@ | |
| -== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,33)> | |
| +== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,36)> | |
| 0000 definemethod :x, x ( 1)[Li] | |
| 0003 putself | |
| 0004 putobject 4 | |
| 0006 opt_send_without_block <calldata!mid:x, argc:1, FCALL|ARGS_SIMPLE> | |
| 0008 leave |
This file contains hidden or 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
| ### Renames:: | |
| * Minitest.__run becomes Minitest.run_all_suites | |
| * Runnable.run becomes Runnable.run_suite | |
| * Minitest.run_one_method becomes Runnable.run (essentially, see below) | |
| ### Additions:: | |
| * Added Runnable#filter_runnable_methods # extraction from Runnable.run_suite | |
| * ? maybe add --plugins option? |
NewerOlder