fastest 0.0.3

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.
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ pkg/*
4
+ graph.png
5
+ .yardoc/*
6
+ doc/*
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm --create use ruby-1.9.2@a
@@ -0,0 +1,85 @@
1
+ #fastest
2
+
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)
5
+ which tries to be performant, with eye-catchy reports and easy to use.
6
+
7
+ Originally named **a**, the name was too much for Google so I changed it.
8
+
9
+ Heavily inspired by Konstantin Haase's [almost-sinatra](
10
+ http://github.com/rkh/almost-sinatra), its long-term purpose is to become the
11
+ fastest testing framework available.
12
+
13
+ In order to contribute to **fastest**, you have to bear in mind that the code
14
+ **must** stay under 7 lines and with **less than 80 chars** per line. There is
15
+ room for optimization.
16
+
17
+ ##Features
18
+
19
+ * Setup / Teardown
20
+ * Assertions (using the `a` method)
21
+ * Report tests/assertions/failures
22
+ * Keep track of lines where failures happened
23
+
24
+ ##Install
25
+
26
+ $ gem install fastest
27
+
28
+ Or in your Gemfile:
29
+
30
+ gem 'fastest'
31
+
32
+ ##Usage
33
+
34
+ ````ruby
35
+ require 'fastest'
36
+
37
+ # Every test case must inherit from the A class
38
+ class MyTestCase < A
39
+ def setup
40
+ @user = { :some => :object }
41
+ end
42
+
43
+ def test_user_has_property
44
+ a @user[:some] == :object
45
+ a !@user[:other]
46
+ end
47
+
48
+ def teardown
49
+ @user = nil
50
+ end
51
+ end
52
+
53
+ class MyOtherTestCase < A
54
+ def setup
55
+ @foo = [1,2,3]
56
+ end
57
+
58
+ def test_user_has_property
59
+ a @foo.length == 3
60
+ a @foo[2] > 934 # Should fail at line 27
61
+
62
+ @foo[1] = 99
63
+
64
+ a @foo[1] != 2
65
+ end
66
+
67
+ def teardown
68
+ @bar = :something
69
+ end
70
+ end
71
+ ````
72
+
73
+ And voilà:
74
+
75
+ ![a](http://dl.dropbox.com/u/2571594/a_screenshot.png)
76
+
77
+ ##Disclaimer
78
+
79
+ **fastest** has no automated tests nor documentation, and I will have to turn
80
+ down any pull request that contains those, unless the tests are written in
81
+ **fastest** itself.
82
+
83
+ ## Copyright
84
+
85
+ Copyright (c) 2011 Josep M. Bach. Released under the MIT license.
@@ -0,0 +1,19 @@
1
+ $: << 'lib'
2
+
3
+ require 'fastest'
4
+
5
+ class TestGroup < A
6
+ def test_falsiness
7
+ a false == false
8
+ end
9
+
10
+ def test_nilness
11
+ a nil == nil
12
+ end
13
+ end
14
+
15
+ class MySecondTestCase < A
16
+ def not_trueliness
17
+ a true != false
18
+ end
19
+ end
@@ -0,0 +1,42 @@
1
+ $: << 'lib'
2
+
3
+ require 'fastest'
4
+
5
+ class MyTestCase < A
6
+ def setup
7
+ @user = { :some => :object }
8
+ end
9
+
10
+ def test_user_has_property
11
+ a @user[:some] == :object
12
+ a !@user[:other]
13
+ end
14
+
15
+ def test_user_has_another_property
16
+ a @user[:some] == :object
17
+ a !@user[:other]
18
+ end
19
+
20
+ def teardown
21
+ @user = nil
22
+ end
23
+ end
24
+
25
+ class MyOtherTestCase < A
26
+ def setup
27
+ @foo = [1,2,3]
28
+ end
29
+
30
+ def test_user_has_property
31
+ a @foo.length == 3
32
+ a @foo[2] > 934 # Should fail at line 27
33
+
34
+ @foo[1] = 99
35
+
36
+ a @foo[1] != 2
37
+ end
38
+
39
+ def teardown
40
+ @bar = :something
41
+ end
42
+ end
@@ -0,0 +1,16 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Josep M. Bach"]
5
+ gem.email = ["josep.m.bach@gmail.com"]
6
+ gem.description = %q{th fstst tstng frmwrk.}
7
+ gem.summary = %q{th fstst tstng frmwrk.}
8
+ gem.homepage = 'http://github.com/txus/fastest'
9
+
10
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
11
+ gem.files = `git ls-files`.split("\n")
12
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
+ gem.name = "fastest"
14
+ gem.require_paths = ['lib']
15
+ gem.version = '0.0.3'
16
+ end
@@ -0,0 +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.\
4
+ map{|f|"\e[1;31mFailure\e[0m \e[97m@\e[33m #{f}\e[0m"}.join(?\n);exit 1 if$f[0]
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=[]
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastest
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.3
6
+ platform: ruby
7
+ authors:
8
+ - Josep M. Bach
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-07-19 00:00:00 Z
14
+ dependencies: []
15
+
16
+ description: th fstst tstng frmwrk.
17
+ email:
18
+ - josep.m.bach@gmail.com
19
+ executables: []
20
+
21
+ extensions: []
22
+
23
+ extra_rdoc_files: []
24
+
25
+ files:
26
+ - .gitignore
27
+ - .rvmrc
28
+ - Readme.md
29
+ - examples/another_example.rb
30
+ - examples/my_test.rb
31
+ - fastest.gemspec
32
+ - lib/fastest.rb
33
+ homepage: http://github.com/txus/fastest
34
+ licenses: []
35
+
36
+ post_install_message:
37
+ rdoc_options: []
38
+
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ requirements: []
54
+
55
+ rubyforge_project:
56
+ rubygems_version: 1.8.4
57
+ signing_key:
58
+ specification_version: 3
59
+ summary: th fstst tstng frmwrk.
60
+ test_files: []
61
+