citron 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +21 -24
- data/{COPYING.rdoc → COPYING.md} +12 -6
- data/HISTORY.md +22 -0
- data/{README.rdoc → README.md} +12 -15
- data/lib/citron.rb +10 -8
- data/lib/citron/test_case.rb +199 -139
- data/lib/citron/test_proc.rb +89 -39
- data/lib/citron/test_setup.rb +47 -25
- data/lib/citron/test_teardown.rb +60 -0
- data/lib/citron/world.rb +3 -0
- data/test/case_basic.rb +7 -0
- data/test/case_parametric_tests.rb +10 -0
- data/test/case_scope.rb +25 -0
- data/test/case_setup.rb +26 -0
- data/test/case_unit.rb +15 -0
- metadata +80 -105
- data/.gemspec +0 -152
- data/.gitignore +0 -6
- data/.yardopts +0 -7
- data/Assembly +0 -56
- data/HISTORY.rdoc +0 -10
- data/MANIFEST +0 -14
- data/PROFILE +0 -31
- data/VERSION +0 -1
- data/bm/minitest_example.rb +0 -33
- data/lib/citron/test_advice.rb +0 -59
- data/site/assets/images/citrons-are-good.png +0 -0
- data/site/assets/images/cut-citron.png +0 -0
- data/site/assets/images/forkme.png +0 -0
- data/site/assets/images/github-logo.png +0 -0
- data/site/assets/images/opensource.png +0 -0
- data/site/assets/images/ruby-logo.png +0 -0
- data/site/assets/images/skin.jpg +0 -0
- data/site/assets/images/skin1.jpg +0 -0
- data/site/assets/images/tap.png +0 -0
- data/site/assets/images/title.png +0 -0
- data/site/assets/images/title2.png +0 -0
- data/site/assets/styles/reset.css +0 -17
- data/site/assets/styles/site.css +0 -47
- data/site/index.html +0 -147
- data/try/.test +0 -2
- data/try/case_example.rb +0 -30
- data/try/case_setup.rb +0 -23
data/HISTORY.rdoc
DELETED
data/MANIFEST
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!mast .ruby .yaropts bin lib spec test [A-Z][A-Z]*
|
2
|
-
.ruby
|
3
|
-
lib/citron/test_advice.rb
|
4
|
-
lib/citron/test_case.rb
|
5
|
-
lib/citron/test_proc.rb
|
6
|
-
lib/citron/test_setup.rb
|
7
|
-
lib/citron/world.rb
|
8
|
-
lib/citron.rb
|
9
|
-
HISTORY.rdoc
|
10
|
-
PROFILE
|
11
|
-
LICENSE.txt
|
12
|
-
README.rdoc
|
13
|
-
VERSION
|
14
|
-
COPYING.rdoc
|
data/PROFILE
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name : citron
|
3
|
-
title : Citron
|
4
|
-
summary: Classic Unit-style Test Framework
|
5
|
-
authors:
|
6
|
-
- Thomas Sawyer <transfire@gmail.com>
|
7
|
-
|
8
|
-
description:
|
9
|
-
Citron is a unit testing framework with a classic
|
10
|
-
test-case/test-unit style.
|
11
|
-
|
12
|
-
resources:
|
13
|
-
home: http://rubyworks.github.com/citron
|
14
|
-
code: http://github.com/rubyworks/citron
|
15
|
-
|
16
|
-
repositories:
|
17
|
-
upstream: git://github.com/proutils/citron.git
|
18
|
-
|
19
|
-
requirements:
|
20
|
-
- test
|
21
|
-
- ae
|
22
|
-
- detroit (build)
|
23
|
-
- reap (build)
|
24
|
-
- qed (test)
|
25
|
-
|
26
|
-
organization: RubyWorks
|
27
|
-
|
28
|
-
copyrights:
|
29
|
-
- 2011 Thomas Sawyer (BSD-2-Clause)
|
30
|
-
|
31
|
-
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.2.0
|
data/bm/minitest_example.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'minitest/unit'
|
2
|
-
require 'minitest/autorun'
|
3
|
-
|
4
|
-
class ShowThemHowToBeatIt < MiniTest::Unit::TestCase
|
5
|
-
|
6
|
-
# will fail
|
7
|
-
def test_show_them_how_to_funky
|
8
|
-
refute_equal("funky", "funky")
|
9
|
-
end
|
10
|
-
|
11
|
-
# will pass
|
12
|
-
def test_show_them_whats_right
|
13
|
-
assert_equal("right", "right")
|
14
|
-
end
|
15
|
-
|
16
|
-
# will error
|
17
|
-
def test_no_one_wants_to_be_defeated
|
18
|
-
raise SyntaxError
|
19
|
-
end
|
20
|
-
|
21
|
-
# pending
|
22
|
-
def test_better_do_what_you_can
|
23
|
-
raise NotImplementedError
|
24
|
-
end
|
25
|
-
|
26
|
-
# omit
|
27
|
-
def test_just_beat_it
|
28
|
-
e = NotImplementedError.new
|
29
|
-
#e.set_assertion(true)
|
30
|
-
raise e
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
data/lib/citron/test_advice.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
module Citron
|
2
|
-
|
3
|
-
# Test Advice
|
4
|
-
class TestAdvice
|
5
|
-
|
6
|
-
# The test case to which this advice belongs.
|
7
|
-
#attr :context
|
8
|
-
|
9
|
-
#
|
10
|
-
attr :table
|
11
|
-
|
12
|
-
# New case instance.
|
13
|
-
def initialize
|
14
|
-
@table = Hash.new{ |h,k| h[k] = {} }
|
15
|
-
end
|
16
|
-
|
17
|
-
#
|
18
|
-
def initialize_copy(original)
|
19
|
-
@table = original.table.clone
|
20
|
-
end
|
21
|
-
|
22
|
-
#
|
23
|
-
def [](type)
|
24
|
-
@table[type.to_sym]
|
25
|
-
end
|
26
|
-
|
27
|
-
=begin
|
28
|
-
#
|
29
|
-
#def teardown=(procedure)
|
30
|
-
# @teardown = procedure
|
31
|
-
#end
|
32
|
-
|
33
|
-
# Setup.
|
34
|
-
def setup(scope=nil)
|
35
|
-
if scope
|
36
|
-
scope.instance_eval(&@setup)
|
37
|
-
else
|
38
|
-
@setup
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# Teardown.
|
43
|
-
def teardown(scope=nil)
|
44
|
-
if scope
|
45
|
-
scope.instance_eval(&@teardown) if @teardown
|
46
|
-
else
|
47
|
-
@teardown
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Returns the description with newlines removed.
|
52
|
-
def to_s
|
53
|
-
description.gsub(/\n/, ' ')
|
54
|
-
end
|
55
|
-
=end
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/site/assets/images/skin.jpg
DELETED
Binary file
|
Binary file
|
data/site/assets/images/tap.png
DELETED
Binary file
|
Binary file
|
Binary file
|
@@ -1,17 +0,0 @@
|
|
1
|
-
html { font-family: sans-serif; font-size: 16px; color: black; }
|
2
|
-
body { padding: 0; margin: 0; font-family: sans-serif; font-size: 12px; background: #fff; }
|
3
|
-
|
4
|
-
h1 { font-size: 90px; margin: 20px; }
|
5
|
-
|
6
|
-
p { font-size: 110%; text-align: justify; margin: 20px 0; line-height: 150%; }
|
7
|
-
|
8
|
-
a { text-decoration: none; font-size: 100%; }
|
9
|
-
a:hover { text-decoration: underline; }
|
10
|
-
|
11
|
-
ul { margin: 0 auto; list-style-type: none; width: 300px; }
|
12
|
-
li { float: left; padding: 10px; text-align: center; }
|
13
|
-
|
14
|
-
pre { font-size: 130%; padding: 10px 0 0 0; -moz-border-radius: 10px; font-family: courier, monospace; color: #000; }
|
15
|
-
code { font-family: courier, monospace; }
|
16
|
-
|
17
|
-
img { border: none; }
|
data/site/assets/styles/site.css
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
html { font-size: 16px; }
|
2
|
-
|
3
|
-
h1 { font-family: times; font-size: 400%; margin: 20px 0; color: #f7d901; }
|
4
|
-
h2 { font-size: 220%; margin-top: 30px; color: #444; }
|
5
|
-
h3 { font-size: 190%; color: green; }
|
6
|
-
|
7
|
-
p { color: #222; font-weight: normal; font-size: 110%; }
|
8
|
-
a { color: #262; }
|
9
|
-
a:hover { text-decoration: underline; }
|
10
|
-
|
11
|
-
pre { background: #ffffff; -moz-border-radius: 10px; line-height: 140%; font-size: 0.9em; }}
|
12
|
-
code { color: #222; font-weight: bold; }
|
13
|
-
tt { color: #222; font-weight: bold; }
|
14
|
-
|
15
|
-
#nav { padding: 0 30px 20px 60px; text-align: left; color: pink; float: right; }
|
16
|
-
#nav a { font-size: 160%; font-weight: bold; line-height: 150%; color: orange; }
|
17
|
-
#nav a:hover { color: #FFF; text-decoration: none; }
|
18
|
-
|
19
|
-
#header { height: 250px; text-align: left; }
|
20
|
-
#header h1 { font-size: 100px; margin-bottom: 0; padding: 40px 0 0 0; color: #f7d901; margin-left: -10px; }
|
21
|
-
#header h2 { padding: 0 0 0 110px; margin-top: 0; }
|
22
|
-
|
23
|
-
#main { color: white; padding: 20px 0 30px 0; background: url(../images/skin.jpg) #f7e931; }
|
24
|
-
#main p { font-weight: bold; font-family: sans-serif; font-size: 1.8em; color: #222; font-weight: bold; text-shadow: 1px 1px white; }
|
25
|
-
#main h2 { color: #333333; }
|
26
|
-
#main h3 { color: #333333; }
|
27
|
-
|
28
|
-
#example p { font-size: 2em; }
|
29
|
-
|
30
|
-
#footer { margin-top: 40px; padding: 40px 0; text-align: center; background: url(../images/skin.jpg) #f7e931; }
|
31
|
-
#footer .copyright { padding-top: 0; }
|
32
|
-
#footer .copyright p { color: #222; font-weight: normal; font-size: 80%; line-height: 150%; }
|
33
|
-
|
34
|
-
#forkme {
|
35
|
-
position: absolute;
|
36
|
-
top: 0; right: 0;
|
37
|
-
width: 150px;
|
38
|
-
}
|
39
|
-
|
40
|
-
.page { width: 730px; margin: 0 auto; }
|
41
|
-
|
42
|
-
.bordered { border-top: 2px solid #99ff99; border-bottom: 2px solid #99ff99; }
|
43
|
-
|
44
|
-
.copyright { padding: 0; text-align: left; }
|
45
|
-
.copyright td { font-size: 10px; color: #444; }
|
46
|
-
|
47
|
-
|
data/site/index.html
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<title>Citron</title>
|
4
|
-
<link href="assets/styles/reset.css" rel="stylesheet" type="text/css"/>
|
5
|
-
<link href="assets/styles/site.css" rel="stylesheet" type="text/css"/>
|
6
|
-
<link href="assets/images/citron.jpg" rel="shortcut icon"/>
|
7
|
-
|
8
|
-
<!-- syntax highlighing -->
|
9
|
-
<script src="http://rubyworks.github.com/assets/includes/shjs/sh_main.min.js"></script>
|
10
|
-
<script src="http://rubyworks.github.com/assets/includes/shjs/lang/sh_ruby.min.js"></script>
|
11
|
-
<script src="http://rubyworks.github.com/assets/includes/shjs/lang/sh_sh.min.js"></script>
|
12
|
-
<link href="http://rubyworks.github.com/assets/includes/shjs/css/sh_acid.min.css" rel="stylesheet" type="text/css" />
|
13
|
-
</head>
|
14
|
-
<body onload="sh_highlightDocument();">
|
15
|
-
|
16
|
-
<div id="forkme">
|
17
|
-
<a href="http://github.com/rubyworks/citron"><img src="assets/images/forkme.png" /></a>
|
18
|
-
</div>
|
19
|
-
|
20
|
-
<div id="header">
|
21
|
-
<div class="page">
|
22
|
-
<img src="assets/images/cut-citron.png" height="200px" align="right" style="padding-top: 15px;"/>
|
23
|
-
<h1><img src="assets/images/title.png"/></h1>
|
24
|
-
<h2>Clean Classic Testing</h2>
|
25
|
-
</div>
|
26
|
-
</div>
|
27
|
-
|
28
|
-
<div id="main" class="bordered">
|
29
|
-
<div class="page">
|
30
|
-
|
31
|
-
<p>Citron is classic unit testing framework with a clear domain specific language
|
32
|
-
notating testcase and test procedure, that runs on top of the Ruby Universal Test
|
33
|
-
Harness, <a href="http://rubyworks.github.com/test">Ruby Test</a>.</p>
|
34
|
-
|
35
|
-
<!--
|
36
|
-
<p>Citron uses the <a href="http://rubyworks.github.com/ae">Assertive Expressive</a>
|
37
|
-
assertions framework. This is the same verstile framework used by <a href="http://rubyworks.github.com/qed">Q.E.D.</a>.
|
38
|
-
By default Citron test support the standard <code>#assert</code> and <code>#expect</code> assertion methods.
|
39
|
-
If you wish to use subjunctive terms, either <code>#should</code> or <code>#must</code>, you can load these
|
40
|
-
via a helper script (eg. <code>require 'ae/should'</code>).</p>
|
41
|
-
-->
|
42
|
-
|
43
|
-
</div>
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="example">
|
47
|
-
<div class="page">
|
48
|
-
|
49
|
-
<div id="nav">
|
50
|
-
<!-- <a href="guide/doc.en/index.html">English Manual</a> · -->
|
51
|
-
<a href="http://wiki.github.com/rubyworks/citron">Wiki</a>
|
52
|
-
<a href="http://rubydoc.info/gems/citron/frames">API</a>
|
53
|
-
<a href="http://googlegroups.com/group/rubyworks-mailinglist">Email</a>
|
54
|
-
<a href="http://github.com/rubyworks/citron/issues">Issue</a>
|
55
|
-
<a href="http://github.com/rubyworks/citron">Code</a>
|
56
|
-
</div>
|
57
|
-
|
58
|
-
<h3>Example</h3>
|
59
|
-
|
60
|
-
<p>Citron tests are organized into test cases and test procedures.
|
61
|
-
Here is an example:</p>
|
62
|
-
|
63
|
-
<pre class="sh_ruby">
|
64
|
-
TestCase "Show them how to Beat It" do
|
65
|
-
|
66
|
-
# will fail
|
67
|
-
test "show them how to funky" do
|
68
|
-
"funky".assert != "funky"
|
69
|
-
end
|
70
|
-
|
71
|
-
# will pass
|
72
|
-
test "show them what's right" do
|
73
|
-
"right".assert == "right"
|
74
|
-
end
|
75
|
-
|
76
|
-
# will error
|
77
|
-
test "no one wants to be defeated" do
|
78
|
-
raise SyntaxError
|
79
|
-
end
|
80
|
-
|
81
|
-
# pending
|
82
|
-
test "better do what you can" do
|
83
|
-
raise NotImplementedError
|
84
|
-
end
|
85
|
-
|
86
|
-
# omit
|
87
|
-
test "just beat it" do
|
88
|
-
e = NotImplementedError.new
|
89
|
-
e.set_assertion(true)
|
90
|
-
raise e
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
94
|
-
</pre>
|
95
|
-
|
96
|
-
<p>The assertion framework is actually independent of the test framework,
|
97
|
-
so almost any assertion system will work. In the example above we are using
|
98
|
-
<a href="http://rubyworks.github.com/ae">A.E.</a></p>
|
99
|
-
|
100
|
-
</div>
|
101
|
-
</div>
|
102
|
-
|
103
|
-
<div id="footer" class="bordered">
|
104
|
-
<div class="page">
|
105
|
-
<script type="text/javascript"><!--
|
106
|
-
google_ad_client = "ca-pub-1126154564663472";
|
107
|
-
/* RUBYWORKS 09-10-02 728x90 */
|
108
|
-
google_ad_slot = "0788888658";
|
109
|
-
google_ad_width = 728;
|
110
|
-
google_ad_height = 90;
|
111
|
-
//-->
|
112
|
-
</script>
|
113
|
-
<script type="text/javascript"
|
114
|
-
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
115
|
-
</script>
|
116
|
-
|
117
|
-
<br/><br/><br/>
|
118
|
-
|
119
|
-
<div class="copyright" width="100%">
|
120
|
-
<a href="http://rubyworks.github.com/">
|
121
|
-
<img src="assets/images/ruby-logo.png" height="110px" align="left" style="margin: 0 5px; padding: 0 10px" />
|
122
|
-
</a>
|
123
|
-
<a href="http://www.apache.org/licenses/LICENSE-2.0.html">
|
124
|
-
<img src="assets/images/opensource.png" height="120px" align="left" style="padding: 0 10px;" />
|
125
|
-
</a>
|
126
|
-
<a href="github.com/rubyworks/citron">
|
127
|
-
<img src="assets/images/github-logo.png" height="115px" align="left" style="margin: 0; padding: 0 10px;" />
|
128
|
-
</a>
|
129
|
-
<a href="http://testanything.org/wiki/index.php/Main_Page">
|
130
|
-
<img src="assets/images/tap.png" height="113px" align="left" style="margin: 0; padding: 0 20px;" />
|
131
|
-
</a>
|
132
|
-
<a href="">
|
133
|
-
<img src="assets/images/citrons-are-good.png" height="117px" align="left" style="margin: 0; padding: 0 10px;" />
|
134
|
-
</a>
|
135
|
-
</div>
|
136
|
-
|
137
|
-
<br style="clear: both;" />
|
138
|
-
|
139
|
-
<div style="margin-top: 30px;">
|
140
|
-
<b>Citron</b>, Copyright © 2009 Thomas Sawyer ·
|
141
|
-
<b>Contact:</b> transfire @ gmail.com
|
142
|
-
</div>
|
143
|
-
</div>
|
144
|
-
</div>
|
145
|
-
|
146
|
-
</body>
|
147
|
-
</html>
|
data/try/.test
DELETED
data/try/case_example.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
TestCase "Show them how to Beat It" do
|
2
|
-
|
3
|
-
# will fail
|
4
|
-
test "show them how to funky" do
|
5
|
-
"funky".assert != "funky"
|
6
|
-
end
|
7
|
-
|
8
|
-
# will pass
|
9
|
-
test "show them what's right" do
|
10
|
-
"right".assert == "right"
|
11
|
-
end
|
12
|
-
|
13
|
-
# will error
|
14
|
-
test "no one wants to be defeated" do
|
15
|
-
raise SyntaxError
|
16
|
-
end
|
17
|
-
|
18
|
-
# pending
|
19
|
-
test "better do what you can" do
|
20
|
-
raise NotImplementedError
|
21
|
-
end
|
22
|
-
|
23
|
-
# omit
|
24
|
-
test "just beat it" do
|
25
|
-
e = NotImplementedError.new
|
26
|
-
e.set_assertion(true)
|
27
|
-
raise e
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
data/try/case_setup.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
test_case "Example of using setup in a testcase" do
|
2
|
-
|
3
|
-
setup do
|
4
|
-
@x = 1
|
5
|
-
end
|
6
|
-
|
7
|
-
test "has setup without a topic" do
|
8
|
-
@x.assert == 1
|
9
|
-
end
|
10
|
-
|
11
|
-
setup "has a topic" do
|
12
|
-
@x = 10
|
13
|
-
end
|
14
|
-
|
15
|
-
test "has setup with a topic" do
|
16
|
-
@x.assert == 10
|
17
|
-
end
|
18
|
-
|
19
|
-
test "alos has setup with a topic" do
|
20
|
-
@x.assert! == 5
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|