Skip to content
This repository has been archived by the owner on May 22, 2021. It is now read-only.

Commit

Permalink
modify NAME tt -> st
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed May 28, 2012
1 parent eb9938f commit f501194
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 69 deletions.
18 changes: 9 additions & 9 deletions Manifest.txt
Expand Up @@ -3,14 +3,14 @@ LICENSE
History.rdoc
Manifest.txt
Rakefile
lib/tt.rb
lib/tt/version.rb
lib/tt/singletonclass.rb
lib/tt/reports.rb
lib/tt/objectextension.rb
lib/tt/exceptionextension.rb
lib/tt/ext.rb
lib/tt/main.rb
lib/st.rb
lib/st/version.rb
lib/st/singletonclass.rb
lib/st/reports.rb
lib/st/objectextension.rb
lib/st/exceptionextension.rb
lib/st/ext.rb
lib/st/main.rb
test/test_helper.rb
test/test_tt.rb
test/test_st.rb
example.rb
16 changes: 8 additions & 8 deletions README.rdoc
@@ -1,11 +1,11 @@
= tt
= st

code :: http://github.com/kachick/tt
gem :: http://rubygems.org/gems/tt
code :: hstp://github.com/kachick/st
gem :: hstp://rubygems.org/gems/st

== Description

A Tiny Testing framework.
A Simplified Testing Framework.

== Futures

Expand All @@ -15,11 +15,11 @@ A Tiny Testing framework.

* Setup
require 'my_codes' # Write here tha path, your lib or codes
require 'tt' # at Last of requires
require 'st' # at Last of requires

* Overviwe

TT 'Successful case' do
ST 'Successful case' do

s = 'Sample Strings'

Expand All @@ -45,7 +45,7 @@ A Tiny Testing framework.
# 9 tests: Pass: 9 - Fail: 0
# ------------------------------------------------------------------------------

TT 'Failer case' do
ST 'Failer case' do

s = 'Sample Strings'

Expand Down Expand Up @@ -92,7 +92,7 @@ A Tiny Testing framework.

== Installation

* gem install tt
* gem install st

== License

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -4,7 +4,7 @@ require 'fileutils'

Hoe.plugin :newgem

$hoe = Hoe.spec 'tt' do
$hoe = Hoe.spec 'st' do
developer 'Kenichi Kamiya', 'kachick1+ruby@gmail.com'
self.rubyforge_name = name
require_ruby_version '>= 1.9.2'
Expand Down
6 changes: 3 additions & 3 deletions example.rb
@@ -1,9 +1,9 @@
$VERBOSE = true

require_relative 'lib/tt'
require_relative 'lib/st'


TT 'Successful case' do
ST 'Successful case' do

s = 'Sample Strings'

Expand All @@ -25,7 +25,7 @@

end

TT 'Failer case' do
ST 'Failer case' do

s = 'Sample Strings'

Expand Down
9 changes: 9 additions & 0 deletions lib/st.rb
@@ -0,0 +1,9 @@
# Copyright (C) 2012 Kenichi Kamiya

require_relative 'st/version'
require_relative 'st/reports'
require_relative 'st/singletonclass'
require_relative 'st/objectextension'
require_relative 'st/exceptionextension'
require_relative 'st/ext'
require_relative 'st/main'
14 changes: 7 additions & 7 deletions lib/tt/exceptionextension.rb → lib/st/exceptionextension.rb
@@ -1,32 +1,32 @@
# Copyright (C) 2012 Kenichi Kamiya


module TT
module ST

module ExceptionExtension

# pass if occured the error is a own/subclassis instance
def RESCUE(&block)
block.call
rescue self
TT.pass
ST.pass
rescue Exception
TT.fail RescueFailedMissMatch.new($!, self, caller[1])
ST.fail RescueFailedMissMatch.new($!, self, caller[1])
else
TT.fail RescueFailedNoError.new(self, caller[1])
ST.fail RescueFailedNoError.new(self, caller[1])
end

# pass if occured the error is just a own instance
def CATCH(&block)
block.call
rescue Exception
if $!.instance_of? self
TT.pass
ST.pass
else
TT.fail CatchFailedMissMatch.new($!, self, caller[1])
ST.fail CatchFailedMissMatch.new($!, self, caller[1])
end
else
TT.fail CatchFailedNoError.new(self, caller[1])
ST.fail CatchFailedNoError.new(self, caller[1])
end

end
Expand Down
21 changes: 21 additions & 0 deletions lib/st/ext.rb
@@ -0,0 +1,21 @@
# Copyright (C) 2012 Kenichi Kamiya

class Object

unless (instance_methods & ST::ObjectExtension.instance_methods(false)).empty?
warn 'Already defined the ST methods'
end

include ST::ObjectExtension

end

class Exception

unless (methods & ST::ExceptionExtension.instance_methods(false)).empty?
warn 'Already defined the ST methods'
end

extend ST::ExceptionExtension

end
8 changes: 4 additions & 4 deletions lib/tt/main.rb → lib/st/main.rb
@@ -1,14 +1,14 @@
# Copyright (C) 2012 Kenichi Kamiya

def TT(title=nil)
def ST(title=nil)
puts "# #{title || caller.first}"

TT.setup
ST.setup
yield
rescue Exception
$stderr.puts 'Unkonw error occured', $!
else
TT.report
ST.report
ensure
TT.teardown
ST.teardown
end
4 changes: 2 additions & 2 deletions lib/tt/objectextension.rb → lib/st/objectextension.rb
@@ -1,7 +1,7 @@
# Copyright (C) 2012 Kenichi Kamiya


module TT
module ST

module ObjectExtension

Expand Down Expand Up @@ -55,7 +55,7 @@ def RESPOND?(message)

instance_methods(false).grep(/\A(?<mname>[A-Z]+)\?\z/) do |predicate|
define_method $~[:mname].to_sym do |other|
(__send__ predicate, other) ? TT.pass : TT.fail(TestFailed.new self, other, __callee__, caller.first)
(__send__ predicate, other) ? ST.pass : ST.fail(TestFailed.new self, other, __callee__, caller.first)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/tt/reports.rb → lib/st/reports.rb
@@ -1,6 +1,6 @@
# Copyright (C) 2012 Kenichi Kamiya

module TT
module ST

TestFailed = Struct.new :target, :expected, :comparison, :caller do
def to_s
Expand Down
2 changes: 1 addition & 1 deletion lib/tt/singletonclass.rb → lib/st/singletonclass.rb
@@ -1,7 +1,7 @@
# Copyright (C) 2012 Kenichi Kamiya


module TT
module ST

@failers, @pass_counter = [], 0

Expand Down
2 changes: 1 addition & 1 deletion lib/tt/version.rb → lib/st/version.rb
@@ -1,4 +1,4 @@
module TT
module ST

VERSION = '0.0.1'.freeze

Expand Down
9 changes: 0 additions & 9 deletions lib/tt.rb

This file was deleted.

21 changes: 0 additions & 21 deletions lib/tt/ext.rb

This file was deleted.

2 changes: 1 addition & 1 deletion test/test_helper.rb
@@ -1,2 +1,2 @@
require 'test/unit'
require_relative '../lib/tt'
require_relative '../lib/st'
2 changes: 1 addition & 1 deletion test/test_tt.rb → test/test_st.rb
@@ -1,7 +1,7 @@
$VERBOSE = true
require_relative 'test_helper'

class TestTT < Test::Unit::TestCase
class TestST < Test::Unit::TestCase

def test_assertions_succeed
it = 'Sample String'
Expand Down

0 comments on commit f501194

Please sign in to comment.