Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for 'include' and move Test.rb into the Test module.
- Loading branch information
Showing
72 changed files
with
232 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
module Test | ||
$testnum = 1 | ||
$failed = 0 | ||
$planned = 0 | ||
$started = 0 | ||
$todo_upto = 0 | ||
$todo_reason | ||
|
||
def plan(num) | ||
print '1..',num,"\n" | ||
$started = 1 | ||
$testnum = 1 | ||
$planned = num | ||
end | ||
|
||
def pass(desc='') | ||
proclaim(1,desc) | ||
end | ||
|
||
def flunk(desc='') | ||
proclaim(0,desc) | ||
end | ||
|
||
def ok(cond,desc='') | ||
proclaim(cond, desc) | ||
end | ||
|
||
def nok(cond,desc='') | ||
if cond then | ||
flunk desc | ||
else | ||
pass desc | ||
end | ||
end | ||
|
||
def is(got,expected,desc='') | ||
proclaim(got == expected, desc) | ||
end | ||
|
||
def isgt(got,expected,desc='') | ||
proclaim(got > expected, desc) | ||
end | ||
|
||
def isge(got,expected,desc='') | ||
proclaim(got >= expected, desc) | ||
end | ||
|
||
def isnt(got,expected,desc='') | ||
proclaim(got != expected, desc) | ||
end | ||
|
||
def todo(reason,count=1) | ||
$todo_upto = $testnum + count | ||
$todo_reason = '# TODO ' + reason | ||
end | ||
|
||
def skip(reason='',count=1) | ||
1.upto(count) { proclaim(1,'# SKIP ' + reason) } | ||
end | ||
|
||
def skip_rest(reason='') | ||
skip(reason,$planned - $testnum) | ||
end | ||
|
||
def proclaim(cond,desc) | ||
if cond then | ||
else | ||
print "n" | ||
$failed += 1 if $todo_upto < $testnum | ||
end | ||
print 'ok ', $testnum, ' - ', desc | ||
$testnum += 1 | ||
if $todo_reason and $todo_upto < $testnum then | ||
print $todo_reason | ||
end | ||
puts | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
|
||
plan 7 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 12 | ||
|
||
ok 1 < 2, '<'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 12 | ||
|
||
i = 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
|
||
plan 3 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 3 | ||
|
||
ok "foo" =~ /oo/, 'basic regex matching' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 4 | ||
|
||
def foo(*n) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 4 | ||
|
||
items = gather do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 8 | ||
|
||
n = 5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 2 | ||
|
||
class NumberHolder | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 10 | ||
|
||
a = [ 1, 2, 3, 4 ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 8 | ||
|
||
a = Array.new() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 2 | ||
|
||
a = [ "a", "b", "c", "d" ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 2 | ||
|
||
a = [ 1, 2 ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 2 | ||
|
||
a = [ 1, 2, 3 ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 4 | ||
|
||
a = Array.new(2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 1 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 6 | ||
|
||
a = [ 1, 2 ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 6 | ||
|
||
a = [ 0, 1, 2, 3, 4, 5, 6 ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 10 | ||
|
||
a = [ 1, 2 ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 8 | ||
|
||
a = [ 2, 1, 3 ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 1 | ||
|
||
a = [ 1, 2 ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 6 | ||
|
||
a = [ 1, 1, 2, 2, 3, 3, 1, 2, 3, 1, 2, 3] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 3 | ||
|
||
a = %w{ fe fi fo } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 4 | ||
|
||
a = 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 4 | ||
|
||
1.upto(2) { |x| is x, x, 'curly brace block' } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 2 | ||
|
||
is RUBY_PLATFORM, 'parrot', 'RUBY_PLATORM' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 4 | ||
|
||
k = 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 4 | ||
|
||
d = Dir.new('.') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 12 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 1 | ||
|
||
class NumberHolder | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 4 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 5 | ||
|
||
a = { "a" => "ok", "b" => 1} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 5 | ||
j = 0 | ||
5.times do |i| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 1 | ||
|
||
pass '.exit! on Kernel' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 2 | ||
|
||
pipe = open("| echo *.t") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require 'test' | ||
require 'Test' | ||
include Test | ||
plan 3 | ||
|
||
|
||
|
Oops, something went wrong.