From 9b4cb69a88163340cac7c0a350eaf18832edb28f Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Fri, 15 Dec 2023 18:59:54 +0900 Subject: [PATCH] support `skip` in bootstraptest --- bootstraptest/runner.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index c8ba824407..6b5851e67a 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -552,8 +552,13 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc) filename = "bootstraptest.#{self.path}_#{self.lineno}_#{self.id}.rb" File.open(filename, 'w') {|f| f.puts "#frozen_string_literal:true" if frozen_string_literal - f.puts "GC.stress = true" if $stress - f.puts "print(begin; #{self.src}; end)" + if $stress + f.puts "GC.stress = true" if $stress + else + f.puts "" + end + f.puts "class BT_Skip < Exception; end; def skip(msg) = raise(BT_Skip, msg.to_s)" + f.puts "print(begin; #{self.src}; rescue BT_Skip; $!.message; end)" } filename end