Sha256: ed2280d0a587557abf67ccc73a75386f55417f9c65184b39ef9069d53f20e53e

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

#!/usr/bin/env ruby

require 'minitest/unit'
require 'json'

def suppress_autorun
  Class.new(MiniTest::Unit) do
    # A warning is generated when class instance variables are modified from
    # anonymous classes.  Need to use class_variable_set, which is public in
    # 1.9 and private in 1.8.
    # See http://sequel.heroku.com/2010/06/17/ruby-192-compatibility/
    #
    self.send :class_variable_set, :@@installed_at_exit, true
  end
end

suppress_autorun

require 'test/unit'

def get_doc name
  require 'yard'
  require 'stringio'

  YARD::CLI::YRI::DEFAULT_SEARCH_PATHS.push('.flustered.yardoc')
  yri = YARD::CLI::YRI.new

  out = StringIO.new
  $stdout = out
  hasdoc = yri.send(:find_object, name) != nil
  YARD::CLI::YRI.new.run('--no-pager', name) if hasdoc
ensure
  $stdout = STDOUT

  out.read

end


name = 'math'
require_relative "#{name}/#{name}"

# Instead of exit, look for EOF!
Command = Struct.new(:command, :timeout) do
end

data = JSON.parse(STDIN.read)
c = Command.new(data['command'], data['timeout'])

Test::Unit::TestCase.test_suites.each do |s|
  s.test_methods.each do |t|
    p "#{s} : #{t}"
    doc = get_doc "#{s}##{t}"
    p doc if doc
    instance = s.new t
    runner = MiniTest::Unit.new
    result = instance.run(runner)
    p result
    runner.instance_eval { p @report } unless result == '.'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flustered-0.1.1 lib/flustered/adapters/minitest.rb