fastest 0.0.3 → 0.1.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.
data/Readme.md CHANGED
@@ -1,7 +1,7 @@
1
1
  #fastest
2
2
 
3
3
  **fastest** is a testing framework written in [6 lines of code](
4
- https://github.com/txus/fastest/blob/master/lib/fastest.rb) (or 461 characters)
4
+ https://github.com/txus/fastest/blob/master/lib/fastest.rb) (or 473 characters)
5
5
  which tries to be performant, with eye-catchy reports and easy to use.
6
6
 
7
7
  Originally named **a**, the name was too much for Google so I changed it.
@@ -14,6 +14,11 @@ In order to contribute to **fastest**, you have to bear in mind that the code
14
14
  **must** stay under 7 lines and with **less than 80 chars** per line. There is
15
15
  room for optimization.
16
16
 
17
+ In case more sophisticated behavior was needed, it could be included as an
18
+ **optionally loadable addon**. An example of this is [fastest/parallel](
19
+ https://github.com/txus/fastest/blob/master/lib/fastest/parallel.rb), an addon
20
+ that enables your tests to run in parallel, which means faster.
21
+
17
22
  ##Features
18
23
 
19
24
  * Setup / Teardown
@@ -29,11 +34,17 @@ Or in your Gemfile:
29
34
 
30
35
  gem 'fastest'
31
36
 
37
+ ##Addons
38
+
39
+ * Require `fastest/parallel` in your test helper or suite to run your tests
40
+ in parallel.
41
+
32
42
  ##Usage
33
43
 
34
44
  ````ruby
35
45
  require 'fastest'
36
46
 
47
+
37
48
  # Every test case must inherit from the A class
38
49
  class MyTestCase < A
39
50
  def setup
@@ -0,0 +1,13 @@
1
+ $: << 'lib'
2
+
3
+ require 'fastest'
4
+ require 'fastest/parallel'
5
+
6
+ class ParallelTestCase < A
7
+ 100.times do |i|
8
+ define_method("test_#{i}") do
9
+ a 3
10
+ sleep "0.#{i}".to_f
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ $: << 'lib'
2
+
3
+ require 'fastest'
4
+
5
+ class ParallelTestCase < A
6
+ 100.times do |i|
7
+ define_method("test_#{i}") do
8
+ a 3
9
+ sleep "0.#{i}".to_f
10
+ end
11
+ end
12
+ end
@@ -12,5 +12,5 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
13
  gem.name = "fastest"
14
14
  gem.require_paths = ['lib']
15
- gem.version = '0.0.3'
15
+ gem.version = '0.1.0'
16
16
  end
@@ -1,6 +1,6 @@
1
- at_exit{$c.map{|t|i=t.new;i.setup rescue 0;$t=t.instance_methods(!0).map{|m|m\
2
- =~/^test_/?(i.send m;1):!0}.compact;i.teardown rescue 0};printf"\e[0m\n%fs\n%d\
3
- tests, %d assertions, %d failures\n\n%s",Time.now-$n,$t.size,$a,$f.size,$f.\
1
+ at_exit{$c.map{|t|i=t.new;$t=t.instance_methods(!0).send($r){|m|m=~/^test_/?(i\
2
+ .setup rescue 0;i.send m;i.teardown rescue 0;1):nil}.compact};printf"\e[0m\n%fs
3
+ %d tests, %d assertions, %d failures\n\n%s",Time.now-$n,$t.size,$a,$f.size,$f.\
4
4
  map{|f|"\e[1;31mFailure\e[0m \e[97m@\e[33m #{f}\e[0m"}.join(?\n);exit 1 if$f[0]
5
5
  };class A;def a c;$a+=1;print"\e[3"+(c ?"2m.":"1mF");$f<<caller[0]if !c;end;def
6
- A.inherited(b);$c<<b;end;end;$n=Time.now;$f=[];$c=[];$a=0;$t=[]
6
+ A.inherited(b);$c<<b;end;end;$n=Time.now;$f=[];$c=[];$a=0;$t=[];$r='map'
@@ -0,0 +1,2 @@
1
+ class Array;def pmap;map{|x|Thread.start{yield x}}.map{|t|t.join.value};end;end
2
+ $r='pmap';
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: fastest
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Josep M. Bach
@@ -10,7 +10,8 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-19 00:00:00 Z
13
+ date: 2011-08-02 00:00:00 +02:00
14
+ default_executable:
14
15
  dependencies: []
15
16
 
16
17
  description: th fstst tstng frmwrk.
@@ -27,9 +28,13 @@ files:
27
28
  - .rvmrc
28
29
  - Readme.md
29
30
  - examples/another_example.rb
31
+ - examples/large_suite_parallel.rb
32
+ - examples/large_suite_serial.rb
30
33
  - examples/my_test.rb
31
34
  - fastest.gemspec
32
35
  - lib/fastest.rb
36
+ - lib/fastest/parallel.rb
37
+ has_rdoc: true
33
38
  homepage: http://github.com/txus/fastest
34
39
  licenses: []
35
40
 
@@ -53,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
58
  requirements: []
54
59
 
55
60
  rubyforge_project:
56
- rubygems_version: 1.8.4
61
+ rubygems_version: 1.6.1
57
62
  signing_key:
58
63
  specification_version: 3
59
64
  summary: th fstst tstng frmwrk.