tryouts 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/tryouts.rb +55 -58
- metadata +20 -36
- data/.gitignore +0 -1
- data/CHANGES.txt +0 -35
- data/README.rdoc +0 -123
- data/VERSION.yml +0 -4
- data/try/step1_try.rb +0 -51
- data/try/step2_try.rb +0 -59
- data/try/step3_try.rb +0 -19
- data/try/step4_try.rb +0 -6
- data/tryouts.gemspec +0 -54
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 64a4341b114113a2302709a5d550682346092cc677c7dbc5933c6d7a3e139fa6
|
4
|
+
data.tar.gz: 7e1f1e8fed19debc6e2b7766e76510c7904c1b565ae6c841571a0c005fbc755f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0d6cb90fb7b6e14cbbff68fd5aa5f0d46e93453490a088cdd613cbaf5f10522409a784015fbe5215fcc27c730003a7d3f380df3c303d8f7f6e0293522ae2df45
|
7
|
+
data.tar.gz: 68f3f1202acf7f7e661435372bf4470462ff254cf2f25dd76902e4a01817d46a40a06e54e8b2a59acfb49c59520682234e19527a6745af0370d45c4cd675e278
|
data/lib/tryouts.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
#require 'pathname'
|
2
|
-
#p Pathname(caller.last.split(':').first)
|
3
1
|
require 'ostruct'
|
4
2
|
|
5
3
|
unless defined?(TRYOUTS_LIB_HOME)
|
6
|
-
TRYOUTS_LIB_HOME = File.expand_path File.dirname(__FILE__)
|
4
|
+
TRYOUTS_LIB_HOME = File.expand_path File.dirname(__FILE__)
|
7
5
|
end
|
8
6
|
|
9
7
|
class Tryouts
|
@@ -31,42 +29,42 @@ class Tryouts
|
|
31
29
|
class << self
|
32
30
|
attr_accessor :debug, :container, :quiet, :noisy
|
33
31
|
attr_reader :cases
|
34
|
-
|
32
|
+
|
35
33
|
def sysinfo
|
36
34
|
require 'sysinfo'
|
37
35
|
@sysinfo ||= SysInfo.new
|
38
36
|
@sysinfo
|
39
37
|
end
|
40
|
-
|
38
|
+
|
41
39
|
def debug?() @debug == true end
|
42
|
-
|
40
|
+
|
43
41
|
def run_all *paths
|
44
42
|
batches = paths.collect do |path|
|
45
43
|
parse path
|
46
44
|
end
|
47
|
-
|
45
|
+
|
48
46
|
all, skipped_tests, failed_tests = 0, 0, 0
|
49
47
|
skipped_batches, failed_batches = 0, 0
|
50
|
-
|
48
|
+
|
51
49
|
msg 'Ruby %s @ %-40s' % [RUBY_VERSION, Time.now], $/
|
52
|
-
|
50
|
+
|
53
51
|
batches.each do |batch|
|
54
|
-
|
52
|
+
|
55
53
|
path = batch.path.gsub(/#{Dir.pwd}\/?/, '')
|
56
|
-
|
54
|
+
|
57
55
|
vmsg '%-60s %s' % [path, '']
|
58
|
-
|
56
|
+
|
59
57
|
before_handler = Proc.new do |t|
|
60
58
|
if Tryouts.noisy
|
61
|
-
vmsg Console.reverse(' %-58s ' % [t.desc.to_s])
|
59
|
+
vmsg Console.reverse(' %-58s ' % [t.desc.to_s])
|
62
60
|
vmsg t.test.inspect, t.exps.inspect
|
63
61
|
end
|
64
62
|
end
|
65
|
-
|
63
|
+
|
66
64
|
batch.run(before_handler) do |t|
|
67
|
-
if t.failed?
|
65
|
+
if t.failed?
|
68
66
|
failed_tests += 1
|
69
|
-
if Tryouts.noisy
|
67
|
+
if Tryouts.noisy
|
70
68
|
vmsg Console.color(:red, t.failed.join($/)), $/
|
71
69
|
else
|
72
70
|
msg ' %s (%s:%s)' % [Console.color(:red, "FAIL"), path, t.exps.first]
|
@@ -88,7 +86,7 @@ class Tryouts
|
|
88
86
|
all += 1
|
89
87
|
end
|
90
88
|
end
|
91
|
-
|
89
|
+
|
92
90
|
msg
|
93
91
|
if all > 0
|
94
92
|
suffix = 'tests passed'
|
@@ -100,22 +98,22 @@ class Tryouts
|
|
100
98
|
suffix = "batches passed"
|
101
99
|
suffix << " (and #{skipped_batches} skipped)" if skipped_batches > 0
|
102
100
|
msg cformat(batches.size-skipped_batches-failed_batches, batches.size-skipped_batches, suffix)
|
103
|
-
end
|
101
|
+
end
|
104
102
|
end
|
105
|
-
|
103
|
+
|
106
104
|
failed_tests # 0 means success
|
107
105
|
end
|
108
|
-
|
106
|
+
|
109
107
|
def cformat(*args)
|
110
108
|
Console.bright '%d of %d %s' % args
|
111
109
|
end
|
112
|
-
|
110
|
+
|
113
111
|
def run path
|
114
112
|
batch = parse path
|
115
113
|
batch.run
|
116
114
|
batch
|
117
115
|
end
|
118
|
-
|
116
|
+
|
119
117
|
def parse path
|
120
118
|
#debug "Loading #{path}"
|
121
119
|
lines = File.readlines path
|
@@ -139,17 +137,17 @@ class Tryouts
|
|
139
137
|
end
|
140
138
|
exps.last += 1
|
141
139
|
end
|
142
|
-
|
140
|
+
|
143
141
|
offset = 0
|
144
142
|
buffer, desc = Section.new(path), Section.new(path)
|
145
|
-
test = Section.new(path, idx) # test start the line before the exp.
|
143
|
+
test = Section.new(path, idx) # test start the line before the exp.
|
146
144
|
blank_buffer = Section.new(path)
|
147
145
|
while (idx-offset >= 0)
|
148
146
|
offset += 1
|
149
147
|
this_line = lines[idx-offset].chomp
|
150
148
|
buffer.unshift this_line if ignore?(this_line)
|
151
149
|
if comment?(this_line)
|
152
|
-
buffer.unshift this_line
|
150
|
+
buffer.unshift this_line
|
153
151
|
end
|
154
152
|
if test?(this_line)
|
155
153
|
test.unshift(*buffer) && buffer.clear
|
@@ -167,47 +165,47 @@ class Tryouts
|
|
167
165
|
desc.unshift *buffer
|
168
166
|
desc.last = test.first-1
|
169
167
|
desc.first = desc.last-desc.size+1
|
170
|
-
# remove empty lines between the description
|
168
|
+
# remove empty lines between the description
|
171
169
|
# and the previous expectation
|
172
|
-
while !desc.empty? && desc[0].empty?
|
170
|
+
while !desc.empty? && desc[0].empty?
|
173
171
|
desc.shift
|
174
172
|
desc.first += 1
|
175
173
|
end
|
176
|
-
break
|
174
|
+
break
|
177
175
|
end
|
178
176
|
end
|
179
|
-
|
177
|
+
|
180
178
|
batch << TestCase.new(desc, test, exps)
|
181
179
|
end
|
182
180
|
end
|
183
|
-
|
181
|
+
|
184
182
|
batch
|
185
183
|
end
|
186
|
-
|
184
|
+
|
187
185
|
def print str
|
188
186
|
return if Tryouts.quiet
|
189
187
|
STDOUT.print str
|
190
188
|
STDOUT.flush
|
191
189
|
end
|
192
|
-
|
190
|
+
|
193
191
|
def vmsg *msg
|
194
192
|
STDOUT.puts *msg if !Tryouts.quiet && Tryouts.noisy
|
195
193
|
end
|
196
|
-
|
194
|
+
|
197
195
|
def msg *msg
|
198
196
|
STDOUT.puts *msg unless Tryouts.quiet
|
199
197
|
end
|
200
|
-
|
198
|
+
|
201
199
|
def err *msg
|
202
200
|
msg.each do |line|
|
203
201
|
STDERR.puts Console.color :red, line
|
204
202
|
end
|
205
203
|
end
|
206
|
-
|
204
|
+
|
207
205
|
def debug *msg
|
208
206
|
STDERR.puts *msg if @debug
|
209
207
|
end
|
210
|
-
|
208
|
+
|
211
209
|
def eval(str, path, line)
|
212
210
|
begin
|
213
211
|
Kernel.eval str, @container.send(:binding), path, line
|
@@ -217,34 +215,34 @@ class Tryouts
|
|
217
215
|
nil
|
218
216
|
end
|
219
217
|
end
|
220
|
-
|
218
|
+
|
221
219
|
private
|
222
|
-
|
220
|
+
|
223
221
|
def expectation? str
|
224
222
|
!ignore?(str) && str.strip.match(/\A\#+\s*=>/)
|
225
223
|
end
|
226
|
-
|
224
|
+
|
227
225
|
def comment? str
|
228
226
|
!str.strip.match(/^\#+/).nil? && !expectation?(str)
|
229
227
|
end
|
230
|
-
|
228
|
+
|
231
229
|
def test? str
|
232
230
|
!ignore?(str) && !expectation?(str) && !comment?(str)
|
233
231
|
end
|
234
|
-
|
232
|
+
|
235
233
|
def ignore? str
|
236
234
|
str.to_s.strip.chomp.empty?
|
237
235
|
end
|
238
|
-
|
236
|
+
|
239
237
|
def test_begin? str
|
240
238
|
ret = !str.strip.match(/\#+\s*TEST/i).nil? ||
|
241
239
|
!str.strip.match(/\A\#\#+[\s\w]+/i).nil?
|
242
240
|
ret
|
243
241
|
end
|
244
242
|
|
245
|
-
|
243
|
+
|
246
244
|
end
|
247
|
-
|
245
|
+
|
248
246
|
class TestBatch < Array
|
249
247
|
class Container
|
250
248
|
def metaclass
|
@@ -262,12 +260,12 @@ class Tryouts
|
|
262
260
|
def run(before_test, &after_test)
|
263
261
|
return if empty?
|
264
262
|
setup
|
265
|
-
ret = self.select { |tc|
|
263
|
+
ret = self.select { |tc|
|
266
264
|
before_test.call(tc) unless before_test.nil?
|
267
|
-
ret = !tc.run
|
265
|
+
ret = !tc.run
|
268
266
|
after_test.call(tc)
|
269
267
|
ret # select failed tests
|
270
|
-
}
|
268
|
+
}
|
271
269
|
@failed = ret.size
|
272
270
|
@run = true
|
273
271
|
clean
|
@@ -306,27 +304,27 @@ class Tryouts
|
|
306
304
|
def run
|
307
305
|
Tryouts.debug '%s:%d' % [@test.path, @test.first]
|
308
306
|
Tryouts.debug inspect, $/
|
309
|
-
expectations = exps.collect { |exp,idx|
|
307
|
+
expectations = exps.collect { |exp,idx|
|
310
308
|
exp =~ /\A\#?\s*=>\s*(.+)\Z/
|
311
309
|
$1 # this will be nil if the expectation is commented out
|
312
310
|
}
|
313
|
-
|
311
|
+
|
314
312
|
# Evaluate test block only if there are valid expectations
|
315
313
|
unless expectations.compact.empty?
|
316
314
|
test_value = Tryouts.eval @test.to_s, @test.path, @test.first
|
317
315
|
@has_run = true
|
318
316
|
end
|
319
|
-
|
317
|
+
|
320
318
|
@passed, @failed, @skipped = [], [], []
|
321
|
-
expectations.each_with_index { |exp,idx|
|
319
|
+
expectations.each_with_index { |exp,idx|
|
322
320
|
if exp.nil?
|
323
321
|
@skipped << ' [skipped]'
|
324
322
|
else
|
325
323
|
exp_value = Tryouts.eval(exp, @exps.path, @exps.first+idx)
|
326
324
|
if test_value == exp_value
|
327
|
-
@passed << ' == %s' % [test_value.inspect]
|
325
|
+
@passed << ' == %s' % [test_value.inspect]
|
328
326
|
else
|
329
|
-
@failed << ' != %s' % [test_value.inspect]
|
327
|
+
@failed << ' != %s' % [test_value.inspect]
|
330
328
|
end
|
331
329
|
end
|
332
330
|
}
|
@@ -366,9 +364,9 @@ class Tryouts
|
|
366
364
|
end
|
367
365
|
end
|
368
366
|
|
369
|
-
|
367
|
+
|
370
368
|
module Console
|
371
|
-
|
369
|
+
|
372
370
|
# ANSI escape sequence numbers for text attributes
|
373
371
|
ATTRIBUTES = {
|
374
372
|
:normal => 0,
|
@@ -408,7 +406,7 @@ class Tryouts
|
|
408
406
|
:default => 49,
|
409
407
|
:random => 40 + rand(10).to_i
|
410
408
|
}.freeze unless defined? BGCOLOURS
|
411
|
-
|
409
|
+
|
412
410
|
module InstanceMethods
|
413
411
|
def bright
|
414
412
|
Console.bright(self)
|
@@ -426,7 +424,7 @@ class Tryouts
|
|
426
424
|
Console.bgcolor(col, self)
|
427
425
|
end
|
428
426
|
end
|
429
|
-
|
427
|
+
|
430
428
|
def self.bright(str)
|
431
429
|
str = [style(ATTRIBUTES[:bright]), str, default_style].join
|
432
430
|
str.extend Console::InstanceMethods
|
@@ -463,4 +461,3 @@ class Tryouts
|
|
463
461
|
end
|
464
462
|
|
465
463
|
end
|
466
|
-
|
metadata
CHANGED
@@ -1,77 +1,61 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tryouts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
5
|
-
prerelease:
|
4
|
+
version: 2.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Delano Mandelbaum
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2024-04-05 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: sysinfo
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
19
|
+
version: '0.10'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
30
|
-
description: Don't waste your time writing tests
|
26
|
+
version: '0.10'
|
27
|
+
description: 'Tryouts: Don''t waste your time writing tests'
|
31
28
|
email: delano@solutious.com
|
32
29
|
executables:
|
33
30
|
- try
|
34
31
|
extensions: []
|
35
|
-
extra_rdoc_files:
|
36
|
-
- LICENSE.txt
|
37
|
-
- README.rdoc
|
32
|
+
extra_rdoc_files: []
|
38
33
|
files:
|
39
|
-
- .gitignore
|
40
|
-
- CHANGES.txt
|
41
34
|
- LICENSE.txt
|
42
|
-
- README.rdoc
|
43
35
|
- Rakefile
|
44
|
-
- VERSION.yml
|
45
36
|
- bin/try
|
46
37
|
- lib/tryouts.rb
|
47
|
-
- try/step1_try.rb
|
48
|
-
- try/step2_try.rb
|
49
|
-
- try/step3_try.rb
|
50
|
-
- try/step4_try.rb
|
51
|
-
- tryouts.gemspec
|
52
38
|
homepage: http://github.com/delano/tryouts
|
53
|
-
licenses:
|
54
|
-
|
55
|
-
|
56
|
-
|
39
|
+
licenses:
|
40
|
+
- MIT
|
41
|
+
metadata: {}
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
57
44
|
require_paths:
|
58
45
|
- lib
|
59
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
47
|
requirements:
|
62
|
-
- -
|
48
|
+
- - ">="
|
63
49
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
50
|
+
version: 2.6.8
|
65
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
52
|
requirements:
|
68
|
-
- -
|
53
|
+
- - ">="
|
69
54
|
- !ruby/object:Gem::Version
|
70
55
|
version: '0'
|
71
56
|
requirements: []
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
specification_version: 3
|
57
|
+
rubygems_version: 3.5.7
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
76
60
|
summary: Don't waste your time writing tests
|
77
61
|
test_files: []
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
pkg
|
data/CHANGES.txt
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
TRYOUTS, CHANGES
|
2
|
-
|
3
|
-
#### 2.1.0 (2011-02-12) ###############################
|
4
|
-
|
5
|
-
* CHANGE: Default output is less verbose (eg. PASS/FAIL/SKIP)
|
6
|
-
* CHANGE: -q now prints nothing to STDOUT. Check $?. If 0, all tests pass
|
7
|
-
otherwise it contains the number of tests that failed.
|
8
|
-
* ADDED: -v option for increased output.
|
9
|
-
|
10
|
-
|
11
|
-
#### 2.0.4 (2011-01-06) ###############################
|
12
|
-
|
13
|
-
* ADDED: -q option for reduced output.
|
14
|
-
|
15
|
-
#### 2.0.3 (2010-11-03) ###############################
|
16
|
-
|
17
|
-
* FIXED: Print test value not expected value twice!
|
18
|
-
|
19
|
-
#### 2.0.2 (2010-11-03) ###############################
|
20
|
-
|
21
|
-
* FIXED: Properly skip test cases with commented out expectations (i.e ##=>)
|
22
|
-
* CHANGE: Revised CLI output. Print output for each test case as it's running.
|
23
|
-
|
24
|
-
|
25
|
-
#### 2.0.1.002 (2010-07-21) ###############################
|
26
|
-
|
27
|
-
* FIXED: clean error (bad value for range). Didn't run tryouts. Bad Delano!
|
28
|
-
|
29
|
-
#### 2.0.1 (2010-07-21) ###############################
|
30
|
-
|
31
|
-
* FIXED: Fix range of lines executed for clean, was double executing most test defs
|
32
|
-
|
33
|
-
#### 2.0.0 (2010-07-19) ###############################
|
34
|
-
|
35
|
-
Initial 2.0 release.
|
data/README.rdoc
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
= Tryouts v2.0 ALPHA
|
2
|
-
|
3
|
-
<i>Don't waste your time writing tests.</i>
|
4
|
-
|
5
|
-
<b>NOTE: Tryouts syntax changed since 0.x. The old version is still available in the 0.8-FINAL branch.</b>
|
6
|
-
|
7
|
-
Check out the screencast[http://www.rubypulse.com/episode-0.46_tryouts.html] created by Alex Peuchert.
|
8
|
-
|
9
|
-
|
10
|
-
== Basic syntax
|
11
|
-
|
12
|
-
## A very simple test
|
13
|
-
1 + 1
|
14
|
-
#=> 2
|
15
|
-
|
16
|
-
## The test description can spread
|
17
|
-
## across multiple lines. The same
|
18
|
-
## is true for test definitions.
|
19
|
-
a = 'foo'
|
20
|
-
b = 'bar'
|
21
|
-
a + b
|
22
|
-
#=> 'foobar'
|
23
|
-
|
24
|
-
## A test will pass when its return
|
25
|
-
## value equals the expectation.
|
26
|
-
'foo'.class
|
27
|
-
#=> String
|
28
|
-
|
29
|
-
## The expectations are evaluated.
|
30
|
-
1 + 1
|
31
|
-
#=> 1 + 1
|
32
|
-
|
33
|
-
## Here's an example of testing errors
|
34
|
-
begin
|
35
|
-
raise RuntimeError
|
36
|
-
rescue RuntimeError
|
37
|
-
:success
|
38
|
-
end
|
39
|
-
#=> :success
|
40
|
-
|
41
|
-
For real world examples, see the Gibbler[http://github.com/delano/gibbler/tree/master/try/] tryouts.
|
42
|
-
|
43
|
-
== Setup / Cleanup
|
44
|
-
|
45
|
-
All code before the first test definition is assumed to be setup code. All code after the last definition is assumed to be cleanup code. Here is an example:
|
46
|
-
|
47
|
-
|
48
|
-
# This is called after all tests
|
49
|
-
require 'gibbler'
|
50
|
-
Gibbler.digest_type = Digest::SHA256
|
51
|
-
|
52
|
-
## A Symbol can gibbler
|
53
|
-
:anything.gibbler
|
54
|
-
#=> '754f87ca720ec256633a286d9270d68478850b2abd7b0ae65021cb769ae70c08'
|
55
|
-
|
56
|
-
# This will be called after all tests
|
57
|
-
Gibbler.digest_type = Digest::SHA1
|
58
|
-
|
59
|
-
|
60
|
-
== Running Tests
|
61
|
-
|
62
|
-
Try ships with a command-line tool called <tt>try</tt>. When called with no arguments, it will look for files ending with _try.rb in the current directory, or in the subfolder try.
|
63
|
-
|
64
|
-
You can also supply a specific file to test.
|
65
|
-
|
66
|
-
$ try path/2/test.rb
|
67
|
-
Ruby 1.9.1 @ 2011-01-06 12:38:29 -0500
|
68
|
-
|
69
|
-
# TEST 1: test matches result with expectation
|
70
|
-
7 a = 1 + 1
|
71
|
-
8 #=> 2
|
72
|
-
== 2
|
73
|
-
...
|
74
|
-
|
75
|
-
## TEST 12: comments, tests, and expectations can
|
76
|
-
## contain multiple lines
|
77
|
-
13 a = 1
|
78
|
-
14 b = 2
|
79
|
-
15 a + b
|
80
|
-
16 # => 3
|
81
|
-
17 # => 2 + 1
|
82
|
-
== 3
|
83
|
-
== 3
|
84
|
-
|
85
|
-
12 of 12 tests passed (and 5 skipped)
|
86
|
-
|
87
|
-
|
88
|
-
If all tests pass, try exits with a 0. Otherwise it exits with the number of tests that failed.
|
89
|
-
|
90
|
-
|
91
|
-
For reduced output, use the `-q` option:
|
92
|
-
|
93
|
-
$ try -q
|
94
|
-
Ruby 1.9.1 @ 2011-01-06 12:38:29 -0500
|
95
|
-
|
96
|
-
42 of 42 tests passed (and 5 skipped)
|
97
|
-
4 of 4 batches passed
|
98
|
-
|
99
|
-
|
100
|
-
== Installation
|
101
|
-
|
102
|
-
One of:
|
103
|
-
|
104
|
-
$ gem install tryouts
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
== Credits
|
109
|
-
|
110
|
-
* delano[http://github.com/delano]
|
111
|
-
|
112
|
-
With help from:
|
113
|
-
|
114
|
-
* cloudhead[http://github.com/cloudhead]
|
115
|
-
* mynyml[http://github.com/mynyml]
|
116
|
-
|
117
|
-
== Thanks
|
118
|
-
|
119
|
-
* Syntenic[http://syntenic.com/] for the hackfest venue.
|
120
|
-
* AlexPeuchert[http://www.rubypulse.com/] for the screencast.
|
121
|
-
* Christian Michon for suggesting a better default output format.
|
122
|
-
|
123
|
-
<i>This collision was brought to you by Montreal.rb.</i>
|
data/VERSION.yml
DELETED
data/try/step1_try.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'hexoid'
|
3
|
-
|
4
|
-
POOP = 1
|
5
|
-
|
6
|
-
# TEST 1: test matches result with expectation
|
7
|
-
a = 1 + 1
|
8
|
-
#=> 2
|
9
|
-
|
10
|
-
|
11
|
-
## TEST 2: comments, tests, and expectations can
|
12
|
-
## contain multiple lines
|
13
|
-
a = 1
|
14
|
-
b = 2
|
15
|
-
a + b
|
16
|
-
# => 3
|
17
|
-
# => 2 + 1
|
18
|
-
|
19
|
-
# TEST 3: test expectation type matters
|
20
|
-
'foo'.class
|
21
|
-
#=> String
|
22
|
-
|
23
|
-
|
24
|
-
# TEST 4: instance variables can be used in expectations
|
25
|
-
@a = 1
|
26
|
-
@a
|
27
|
-
#=> @a
|
28
|
-
|
29
|
-
|
30
|
-
# TEST 5: test ignores blank lines before expectations
|
31
|
-
@a += 1
|
32
|
-
'foo'
|
33
|
-
|
34
|
-
|
35
|
-
#=> 'foo'
|
36
|
-
|
37
|
-
|
38
|
-
# TEST 6: test allows whiny expectation markers for textmate users *sigh*
|
39
|
-
'foo'
|
40
|
-
# => 'foo'
|
41
|
-
|
42
|
-
|
43
|
-
# TEST 7: test expectations can be commented out
|
44
|
-
'foo'
|
45
|
-
##=> 'this would fail'
|
46
|
-
|
47
|
-
x = raise rescue 'foo'
|
48
|
-
#=> 'foo'
|
49
|
-
|
50
|
-
|
51
|
-
|
data/try/step2_try.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# run me with
|
2
|
-
# ruby -rubygems -Ilib step1_tryouts.rb
|
3
|
-
|
4
|
-
|
5
|
-
## some addition
|
6
|
-
a = 1
|
7
|
-
b = 2
|
8
|
-
a + b + 1
|
9
|
-
# => 4
|
10
|
-
|
11
|
-
|
12
|
-
# multiple expectations
|
13
|
-
'foo' + 'bar'
|
14
|
-
#=> 'foobar'
|
15
|
-
#=> :foobar.to_s
|
16
|
-
|
17
|
-
|
18
|
-
# test ignores comments before expectations
|
19
|
-
'foo'
|
20
|
-
# ignored comment
|
21
|
-
# ignored comment
|
22
|
-
#=> 'foo'
|
23
|
-
|
24
|
-
|
25
|
-
## test uses helper methods
|
26
|
-
## ( #foo is defined on top of file )
|
27
|
-
#foo()
|
28
|
-
##=> foo
|
29
|
-
|
30
|
-
|
31
|
-
#begin
|
32
|
-
# raise
|
33
|
-
#rescue
|
34
|
-
# 'foo'
|
35
|
-
#end
|
36
|
-
##=> 'foo'
|
37
|
-
|
38
|
-
## test handles multiple code lines
|
39
|
-
## only only tests last line against expectation
|
40
|
-
#str = ""
|
41
|
-
#str << 'foo'
|
42
|
-
#str << 'bar'
|
43
|
-
#str
|
44
|
-
##=> 'foobar'
|
45
|
-
##
|
46
|
-
### test failure
|
47
|
-
##'this fails'
|
48
|
-
###=> 'expectation not met'
|
49
|
-
#
|
50
|
-
|
51
|
-
|
52
|
-
#
|
53
|
-
# require 'pathname'
|
54
|
-
# require Pathname(__FILE__).dirname.parent + 'lib/nofw'
|
55
|
-
#
|
56
|
-
# # test failure
|
57
|
-
# 'this fails'
|
58
|
-
# #=> 'expectation not met'
|
59
|
-
#
|
data/try/step3_try.rb
DELETED
data/try/step4_try.rb
DELETED
data/tryouts.gemspec
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "tryouts"
|
8
|
-
s.version = "2.1.1"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Delano Mandelbaum"]
|
12
|
-
s.date = "2012-04-30"
|
13
|
-
s.description = "Don't waste your time writing tests"
|
14
|
-
s.email = "delano@solutious.com"
|
15
|
-
s.executables = ["try"]
|
16
|
-
s.extra_rdoc_files = [
|
17
|
-
"LICENSE.txt",
|
18
|
-
"README.rdoc"
|
19
|
-
]
|
20
|
-
s.files = [
|
21
|
-
".gitignore",
|
22
|
-
"CHANGES.txt",
|
23
|
-
"LICENSE.txt",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION.yml",
|
27
|
-
"bin/try",
|
28
|
-
"lib/tryouts.rb",
|
29
|
-
"try/step1_try.rb",
|
30
|
-
"try/step2_try.rb",
|
31
|
-
"try/step3_try.rb",
|
32
|
-
"try/step4_try.rb",
|
33
|
-
"tryouts.gemspec"
|
34
|
-
]
|
35
|
-
s.homepage = "http://github.com/delano/tryouts"
|
36
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
-
s.require_paths = ["lib"]
|
38
|
-
s.rubyforge_project = "tryouts"
|
39
|
-
s.rubygems_version = "1.8.22"
|
40
|
-
s.summary = "Don't waste your time writing tests"
|
41
|
-
|
42
|
-
if s.respond_to? :specification_version then
|
43
|
-
s.specification_version = 3
|
44
|
-
|
45
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
-
s.add_runtime_dependency(%q<sysinfo>, [">= 0.7.3"])
|
47
|
-
else
|
48
|
-
s.add_dependency(%q<sysinfo>, [">= 0.7.3"])
|
49
|
-
end
|
50
|
-
else
|
51
|
-
s.add_dependency(%q<sysinfo>, [">= 0.7.3"])
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|