bin/smoke_runner.rb in steep-0.11.1 vs bin/smoke_runner.rb in steep-0.12.0

- old
+ new

@@ -1,12 +1,14 @@ #!/usr/bin/env ruby require "pathname" +$LOAD_PATH << Pathname(__dir__) + '../vendor/ruby-signature/lib' $LOAD_PATH << Pathname(__dir__) + "../lib" require "steep" +require "steep/cli" require "rainbow" require "optparse" verbose = false @@ -42,45 +44,38 @@ if src =~ /!expects\*(@(\+\d+))?/ offset = $2&.to_i || 1 message = src.gsub!(/\A!expects\*(@\+\d+)? +/, '') line = comment.location.line - expectations << Expectation.new(line+offset, message, file).tap {|e| e.prefix_test = true } + expectations << Expectation.new(line+offset, message, file.relative_path_from(dir)).tap {|e| e.prefix_test = true } end if src =~ /!expects(@(\+\d+))?/ offset = $2&.to_i || 1 message = src.gsub!(/\A!expects(@\+\d+)? +/, '') line = comment.location.line - expectations << Expectation.new(line+offset, message, file) + expectations << Expectation.new(line+offset, message, file.relative_path_from(dir)) end if src =~ /ALLOW FAILURE/ - allowed_paths << file + allowed_paths << file.relative_path_from(dir) end end rb_files << file end end stderr = StringIO.new stdout = StringIO.new - builtin = Pathname(__dir__) + "../stdlib" begin - driver = Steep::Drivers::Check.new(source_paths: rb_files, - signature_dirs: [builtin, dir], - stdout: stdout, - stderr: stderr) - - driver.fallback_any_is_error = false - driver.allow_missing_definitions = false - Rainbow.enabled = false - driver.run + Dir.chdir(arg) do + Steep::Drivers::Check.new(stdout: stdout, stderr: stderr).run + end rescue => exn puts "ERROR: #{exn.inspect}" exn.backtrace.each do |loc| puts " #{loc}" end @@ -98,10 +93,10 @@ stderr.string.each_line do |line| puts "stderr> #{line.chomp}" end end - lines = stdout.string.each_line.to_a.map(&:chomp) + lines = stdout.string.each_line.to_a.map(&:chomp).reject {|line| line =~ /\bFallbackAny\b/ } expectations.each do |expectation| deleted = lines.reject! do |string| if expectation.prefix_test string =~ /\A#{Regexp.escape(expectation.path.to_s)}:#{expectation.line}:\d+: #{Regexp.quote expectation.message}/