Sha256: 9b28e3ea1c0005d342f941e6034f0caab0c59c5a6891389d7028025b8eaf6ce6

Contents?: true

Size: 778 Bytes

Versions: 9

Compression:

Stored size: 778 Bytes

Contents

require 'test/unit'
require 'facet/consoleapp'

class RubyCommentTester < Console::Application

  RETEST = /^=begin\s+test.*?\n(.*)\n=end/mi

  # option to display help
  def __verbose ; $VERBOSE = true ; end
  alias_method :_v, :__verbose

  # option to display help
  def __help
    puts HELP
    exit 0
  end
  alias_method :_h, :__help

  def main( *filepaths )
    filepaths.each { |fp|
      run_comment_test( fp )
    }
  end

private

  def run_comment_test( filepath )
    code = File.read( filepath )
    md = RETEST.match( code )
    test_code = md[1]
    unless test_code
      puts "No test found for #{filepath}."
      return nil
    end

    require filepath
    eval test_code, TOPLEVEL_BINDING
  end

end

HELP = <<-EOS
  rubytest filename [filename ...]
EOS

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
reap-4.3.2 lib/reap/bin/rubytest.rb
reap-4.3.4 lib/reap/bin/rubytest.rb
reap-4.4.0 lib/reap/bin/rubytest.rb
reap-4.4.1 lib/reap/bin/rubytest.rb
reap-4.5.0 lib/reap/bin/rubytest.rb
reap-4.5.2 lib/reap/bin/rubytest.rb
reap-5.0.0 lib/reap/bin/rubytest.rb
reap-4.3.3 lib/reap/bin/rubytest.rb
reap-4.5.1 lib/reap/bin/rubytest.rb