Sha256: 4f5677a1868e65cdf50dcc31476e324119068904503f168dff4f8f51c4745fce

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require "pathname"
require "yaml"
require "open3"
require "tempfile"
require "optparse"

OptionParser.new do |opts|
  opts.on("--verbose", "-v") { @verbose = true }
end.parse!(ARGV)

if ARGV.empty?
  test_dirs = (Pathname(__dir__) + "../smoke").children
else
  test_dirs = ARGV.map {|p| Pathname.pwd + p }
end

failed_tests = []

test_dirs.each do |dir|
  puts "Running test #{dir}..."

  unless (dir + "test_expectations.yml").file?
    puts "Skipped ⛹️‍♀️"
    next
  end

  command = %w(steep check --with-expectations=test_expectations.yml)
  puts "  command: #{command.join(" ")}"

  output, status = Open3.capture2(*command, chdir: dir.to_s)

  unless status.success?
    failed_tests << dir.basename
    puts "  Failed! 🤕"
  else
    puts "  Succeed! 👍"
  end

  if @verbose
    puts "  Raw output:"
    output.split(/\n/).each do |line|
      puts "  > #{line.chomp}"
    end
  end
end

if failed_tests.empty?
  puts "All tests ok! 👏"
else
  puts "Errors detected! 🤮"
  puts "  #{failed_tests.join(", ")}"
  exit 1
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
steep-0.43.1 bin/output_test.rb
steep-0.43.0 bin/output_test.rb
steep-0.42.0 bin/output_test.rb
steep-0.41.0 bin/output_test.rb