From 4589056384cdc8ed7c8a99713b216b7176ff49b9 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 2 Jun 2023 20:25:08 +0900 Subject: Exit with a failure if any test files failed to load --- tool/lib/test/unit.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tool/lib') diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb index 7604b4add9..9ce3c8b30a 100644 --- a/tool/lib/test/unit.rb +++ b/tool/lib/test/unit.rb @@ -813,6 +813,7 @@ module Test warn "" @warnings.uniq! {|w| w[1].message} @warnings.each do |w| + @errors += 1 warn "#{w[0]}: #{w[1].message} (#{w[1].class})" end warn "" @@ -1282,8 +1283,13 @@ module Test puts "#{f}: #{$!}" end } + @load_failed = errors.size.nonzero? result end + + def run(*) + super or @load_failed + end end module RepeatOption # :nodoc: all @@ -1680,7 +1686,7 @@ module Test break unless report.empty? end - return failures + errors if self.test_count > 0 # or return nil... + return (failures + errors).nonzero? # or return nil... rescue Interrupt abort 'Interrupted' end -- cgit v1.2.3