testrocketplus 0.0.2

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.
Files changed (2) hide show
  1. data/lib/testrocketplus.rb +34 -0
  2. metadata +54 -0
@@ -0,0 +1,34 @@
1
+ module TestRocket
2
+ module_function
3
+ def init
4
+ $TR_TESTS, $TR_PASSED, $TR_P_TESTS, $TR_P_PASSED = 0,0,0,0
5
+ end
6
+
7
+ def display_results
8
+ puts "\nResults: #{$TR_PASSED}/#{$TR_TESTS} tests passed."
9
+ end
10
+
11
+ module Additions
12
+ def _test(a, b)
13
+ send((call rescue()) ? a : b)
14
+ end
15
+
16
+ def +@; puts _test :_pass, :_fail; end
17
+ def -@; puts _test :_fail, :_pass; end
18
+ def !@; puts _desc; end
19
+ def ~@; puts _pend; end
20
+
21
+ def _pass; $TR_TESTS += 1; $TR_PASSED += 1; ' #-> OK'; end
22
+ def _fail
23
+ $TR_TESTS += 1
24
+ file,line = source_location
25
+ content = (line-1..line+1).map{|i| ['L'+i.to_s,File.readlines(file)[i-1]].join("#{(line==i)? '*':':'} ")}.join " #-> FAIL @ #{[file,line].join(':')}\n#{content}"
26
+ end
27
+ def _desc; "\nCASE \"" + call.to_s + "\": "; end
28
+ def _pend; "\nPENDING! " + call.to_s; end
29
+ end
30
+ end
31
+
32
+ Proc.send :include, TestRocket::Additions
33
+
34
+ TestRocket::init
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: testrocketplus
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.2
6
+ platform: ruby
7
+ authors:
8
+ - Cormac Relf
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-11-12 00:00:00 Z
14
+ dependencies: []
15
+
16
+ description: TestRocket, originally by peterc, and extended by asaaki. `require 'testrocketplus'`
17
+ email: chjrelf@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/testrocketplus.rb
26
+ homepage: https://gist.github.com/1090313
27
+ licenses: []
28
+
29
+ post_install_message:
30
+ rdoc_options: []
31
+
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: "0"
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ requirements: []
47
+
48
+ rubyforge_project:
49
+ rubygems_version: 1.8.13
50
+ signing_key:
51
+ specification_version: 3
52
+ summary: Super simple testing library.
53
+ test_files: []
54
+