class Tryouts::TestCase

def create_proc str, path, line

def create_proc str, path, line
  eval("Proc.new {\n  #{str}\n}", binding, path, line)
end

def failed?

def failed?
  !@failed.nil? && !@failed.empty?
end

def initialize(d,t,e)

def initialize(d,t,e)
  @desc, @test, @exps, @path = d,t,e
end

def inspect

def inspect
  [@desc.inspect, @test.inspect, @exps.inspect].join
end

def run

def run
  Tryouts.debug '%s:%d' % [@test.path, @test.first]
  Tryouts.debug inspect, $/
  expectations = exps.collect { |exp,idx|
    exp =~ /\A\#?\s*=>\s*(.+)\Z/
    $1  # this will be nil if the expectation is commented out
  }
  # Evaluate test block only if there are valid expectations
  unless expectations.compact.empty?
    test_value = Tryouts.eval @test.to_s, @test.path, @test.first
    @has_run = true
  end
  @passed, @failed, @skipped = [], [], []
  expectations.each_with_index { |exp,idx|
    if exp.nil?
      @skipped <<  '     [skipped]'
    else
      exp_value = Tryouts.eval(exp, @exps.path, @exps.first+idx)
      if test_value == exp_value
        @passed << '     ==  %s' % [test_value.inspect]
      else
        @failed << '     !=  %s' % [test_value.inspect]
      end
    end
  }
  Tryouts.debug
  @failed.empty?
end

def run?

def run?
  @has_run == true
end

def skipped?

def skipped?
  !@skipped.nil? && !@skipped.empty?
end

def to_s

def to_s
  [@desc.to_s, @test.to_s, @exps.to_s].join
end