module Test::More

Public Instance Methods

BAIL_OUT(reason) click to toggle source
# File lib/test/more.rb, line 169
def BAIL_OUT reason
  fail "Test::More##{__method__.to_s} not yet implemented"
end
can_ok(method, label) click to toggle source
# File lib/test/more.rb, line 135
def can_ok method, label
  fail "Test::More##{__method__.to_s} not yet implemented"
end
cmp_ok(got, want, label) click to toggle source
# File lib/test/more.rb, line 63
def cmp_ok got, want, label
  fail "Test::More##{__method__.to_s} not yet implemented"
end
diag(msg) click to toggle source
# File lib/test/more.rb, line 147
def diag msg
  fail unless msg
  msg.gsub! /\n/, "\n# "
  $stderr.puts "# #{msg}"
  $stderr.flush
end
done_testing(count=nil) click to toggle source
# File lib/test/more.rb, line 129
def done_testing count=nil
  count ||= $test_more.run
  puts "1..#{count}"
  $stdout.flush
end
eq_array(got, label) click to toggle source
# File lib/test/more.rb, line 101
def eq_array got, label
  fail "Test::More##{__method__.to_s} not yet implemented"
end
eq_hash(got, label) click to toggle source
# File lib/test/more.rb, line 105
def eq_hash got, label
  fail "Test::More##{__method__.to_s} not yet implemented"
end
eq_set(got, label) click to toggle source
# File lib/test/more.rb, line 109
def eq_set got, label
  fail "Test::More##{__method__.to_s} not yet implemented"
end
explain(msg) click to toggle source
# File lib/test/more.rb, line 161
def explain msg
  fail "Test::More##{__method__.to_s} not yet implemented"
end
failed(label) click to toggle source
# File lib/test/more.rb, line 90
def failed label
  $test_more.run_incr
  $test_more.failed_incr
  if ! label.empty?
    puts "not ok #{$test_more.run} - #{label}"
  else
    puts "not ok #{$test_more.run}"
  end
  $stdout.flush
end
is(got, want, label) click to toggle source
# File lib/test/more.rb, line 19
   def is got, want, label
     if got.to_s == want.to_s
       pass label
     else
       failed label
       diag "\
     got: '#{got}'
expected: '#{want}'"
     end
   end
is_deeply(got, want, label) click to toggle source
# File lib/test/more.rb, line 59
def is_deeply got, want, label
  fail "Test::More##{__method__.to_s} not yet implemented"
end
isa_ok(class_, label) click to toggle source
# File lib/test/more.rb, line 139
def isa_ok class_, label
  fail "Test::More##{__method__.to_s} not yet implemented"
end
isnt(got, dont, label) click to toggle source
# File lib/test/more.rb, line 30
   def isnt got, dont, label
     if got.to_s != want.to_s
       pass label
     else
       failed label
       diag "\
     got: '#{got}'
expected: anything else"
     end
   end
like(got, regex, label) click to toggle source
# File lib/test/more.rb, line 41
def like got, regex, label
  if got =~ regex
    pass label
  else
    failed label
    diag "Got: '#{got}'"
  end
end
new_ok(class_, label) click to toggle source
# File lib/test/more.rb, line 143
def new_ok class_, label
  fail "Test::More##{__method__.to_s} not yet implemented"
end
note(msg) click to toggle source
# File lib/test/more.rb, line 154
def note msg
  fail unless msg
  msg.gsub! /\n/, "\n# "
  puts "# #{msg}"
  $stdout.flush
end
ok(got, label) click to toggle source
# File lib/test/more.rb, line 3
def ok got, label
  if got
    pass label
  else
    failed label
  end
end
pass(label) click to toggle source
# File lib/test/more.rb, line 79
def pass label
  $test_more.run_incr
  if ! label.empty?
    puts "ok #{$test_more.run} - #{label}"
    $stderr.flush
  else
    puts "ok #{$test_more.run}"
  end
  $stdout.flush
end
plan(cmd, arg) click to toggle source
# File lib/test/more.rb, line 113
def plan cmd, arg
  fail 'Usage: plan tests <number>' unless cmd and arg
  if cmd == 'tests'
    fail 'Plan must be a number' unless arg.to_s =~ /^-?[0-9]+$/
    fail 'Plan must greater then 0' unless arg > 0
    $test_more.plan = arg
    puts "1..#{$test_more.plan}"
  elsif cmd == 'skip_all'
    puts "1..0 # SKIP #{arg}"
    exit 0
  else
    fail 'Usage: plan tests <number>'
  end
  $stdout.flush
end
require_ok(library, label) click to toggle source
# File lib/test/more.rb, line 15
def require_ok library, label
  fail "Test::More##{__method__.to_s} not yet implemented"
end
skip(reason) click to toggle source
# File lib/test/more.rb, line 67
def skip reason
  fail "Test::More##{__method__.to_s} not yet implemented"
end
subtest(label, callback) click to toggle source
# File lib/test/more.rb, line 165
def subtest label, callback
  fail "Test::More##{__method__.to_s} not yet implemented"
end
todo(label) click to toggle source
# File lib/test/more.rb, line 71
def todo label
  fail "Test::More##{__method__.to_s} not yet implemented"
end
todo_skip(got, want, label) click to toggle source
# File lib/test/more.rb, line 75
def todo_skip got, want, label
  fail "Test::More##{__method__.to_s} not yet implemented"
end
unlike(got, regex, label) click to toggle source
# File lib/test/more.rb, line 50
def unlike got, regex, label
  if got !~ regex
    pass label
  else
    failed label
    diag "Got: '#{got}'"
  end
end
use_ok(library, label) click to toggle source
# File lib/test/more.rb, line 11
def use_ok library, label
  fail "Test::More##{__method__.to_s} not yet implemented"
end