test 0.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.
data/.gemspec ADDED
@@ -0,0 +1,152 @@
1
+ # encoding: utf-8
2
+
3
+ require 'yaml'
4
+
5
+ Gem::Specification.new do |gemspec|
6
+
7
+ manifest = Dir.glob('manifest{,.txt)', File::FNM_CASEFOLD).first
8
+
9
+ scm = case
10
+ when File.directory?('.git')
11
+ :git
12
+ end
13
+
14
+ files = case
15
+ when manifest
16
+ File.readlines(manifest).
17
+ map{ |line| line.srtip }.
18
+ reject{ |line| line.empty? || line[0,1] == '#' }
19
+ when scm == :git
20
+ `git ls-files -z`.split("\0")
21
+ else
22
+ Dir.glob('{**/}{.*,*}') # TODO: be more specific using standard locations ?
23
+ end.select{ |path| File.file?(path) }
24
+
25
+ patterns = {
26
+ :bin_files => 'bin/*',
27
+ :lib_files => 'lib/{**/}*.rb',
28
+ :ext_files => 'ext/{**/}extconf.rb',
29
+ :doc_files => '*.{txt,rdoc,md,markdown,tt,textile}',
30
+ :test_files => '{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'
31
+ }
32
+
33
+ glob_files = lambda { |pattern|
34
+ Dir.glob(pattern).select { |path|
35
+ File.file?(path) && files.include?(path)
36
+ }
37
+ }
38
+
39
+ #files = glob_files[patterns[:files]]
40
+
41
+ executables = glob_files[patterns[:bin_files]].map do |path|
42
+ File.basename(path)
43
+ end
44
+
45
+ extensions = glob_files[patterns[:ext_files]].map do |path|
46
+ File.basename(path)
47
+ end
48
+
49
+ metadata = YAML.load_file('.ruby')
50
+
51
+ # build-out the gemspec
52
+
53
+ case metadata['revision']
54
+ when 0
55
+ gemspec.name = metadata['name']
56
+ gemspec.version = metadata['version']
57
+ gemspec.summary = metadata['summary']
58
+ gemspec.description = metadata['description']
59
+
60
+ metadata['authors'].each do |author|
61
+ gemspec.authors << author['name']
62
+
63
+ if author.has_key?('email')
64
+ if gemspec.email
65
+ gemspec.email << author['email']
66
+ else
67
+ gemspec.email = [author['email']]
68
+ end
69
+ end
70
+ end
71
+
72
+ gemspec.licenses = metadata['licenses']
73
+
74
+ metadata['requirements'].each do |req|
75
+ name = req['name']
76
+ version = req['version']
77
+ groups = req['groups'] || []
78
+
79
+ if md = /^(.*?)([+-~])$/.match(version)
80
+ version = case md[2]
81
+ when '+' then ">= #{$1}"
82
+ when '-' then "< #{$1}"
83
+ when '~' then "~> #{$1}"
84
+ else version
85
+ end
86
+ end
87
+
88
+ #development = req['development']
89
+ #if development
90
+ # # populate development dependencies
91
+ # if gemspec.respond_to?(:add_development_dependency)
92
+ # gemspec.add_development_dependency(name,*version)
93
+ # else
94
+ # gemspec.add_dependency(name,*version)
95
+ # end
96
+ #else
97
+ # # populate runtime dependencies
98
+ # if gemspec.respond_to?(:add_runtime_dependency)
99
+ # gemspec.add_runtime_dependency(name,*version)
100
+ # else
101
+ # gemspec.add_dependency(name,*version)
102
+ # end
103
+ #end
104
+
105
+ if groups.empty? or groups.include?('runtime')
106
+ # populate runtime dependencies
107
+ if gemspec.respond_to?(:add_runtime_dependency)
108
+ gemspec.add_runtime_dependency(name,*version)
109
+ else
110
+ gemspec.add_dependency(name,*version)
111
+ end
112
+ else
113
+ # populate development dependencies
114
+ if gemspec.respond_to?(:add_development_dependency)
115
+ gemspec.add_development_dependency(name,*version)
116
+ else
117
+ gemspec.add_dependency(name,*version)
118
+ end
119
+ end
120
+ end
121
+
122
+ # convert external dependencies into a requirements
123
+ if metadata['external_dependencies']
124
+ ##gemspec.requirements = [] unless metadata['external_dependencies'].empty?
125
+ metadata['external_dependencies'].each do |req|
126
+ gemspec.requirements << req.to_s
127
+ end
128
+ end
129
+
130
+ # determine homepage from resources
131
+ homepage = metadata['resources'].find{ |key, url| key =~ /^home/ }
132
+ gemspec.homepage = homepage.last if homepage
133
+
134
+ gemspec.require_paths = metadata['load_path'] || ['lib']
135
+ gemspec.post_install_message = metadata['install_message']
136
+
137
+ # RubyGems specific metadata
138
+ gemspec.files = files
139
+ gemspec.extensions = extensions
140
+ gemspec.executables = executables
141
+
142
+ if Gem::VERSION < '1.7.'
143
+ gemspec.default_executable = gemspec.executables.first
144
+ end
145
+
146
+ gemspec.test_files = glob_files[patterns[:test_files]]
147
+
148
+ unless gemspec.files.include?('.document')
149
+ gemspec.extra_rdoc_files = glob_files[patterns[:doc_files]]
150
+ end
151
+ end
152
+ end
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .yardoc
2
+ doc
3
+ log
4
+ pkg
5
+ tmp
6
+ site/api
7
+ QED.rdoc
data/.ruby ADDED
@@ -0,0 +1,43 @@
1
+ ---
2
+ authors:
3
+ - name: Thomas Sawyer
4
+ email: transfire@gmail.com
5
+ copyrights:
6
+ - holder: Thomas Sawyer, RubyWorks
7
+ year: '2011'
8
+ license: FreeBSD
9
+ replacements: []
10
+ conflicts: []
11
+ requirements:
12
+ - name: ansi
13
+ - name: detroit
14
+ groups:
15
+ - build
16
+ development: true
17
+ - name: qed
18
+ groups:
19
+ - test
20
+ development: true
21
+ dependencies: []
22
+ repositories:
23
+ - uri: git@github.com:rubyworks/test.git
24
+ scm: git
25
+ name: upstream
26
+ resources:
27
+ home: http://rubyworks.github.com/test
28
+ code: http://github.com/rubyworks/test
29
+ mail: http://groups.google.com/group/rubyworks-mailinglist
30
+ load_path:
31
+ - lib
32
+ extra:
33
+ manifest: MANIFEST
34
+ alternatives: []
35
+ revision: 0
36
+ name: test
37
+ title: Ruby Test
38
+ summary: Ruby Universal Test Harness
39
+ created: '2011-07-23'
40
+ description: Ruby Test is a universal test harness for Ruby. It can handle any compliant test
41
+ framework, even running tests from multiple frameworks in a single pass.
42
+ version: 0.2.0
43
+ date: '2011-08-10'
data/.test ADDED
@@ -0,0 +1,11 @@
1
+ Test.run(:default) do |run|
2
+ run.files << 'test/*_case.rb'
3
+ end
4
+
5
+ Test.run(:cov) do |run|
6
+ run.files << 'test/*_case.rb'
7
+ SimpleCov.start do |cov|
8
+ cov.coverage_dir = 'log/coverage'
9
+ end
10
+ end
11
+
data/.yardopts ADDED
@@ -0,0 +1,7 @@
1
+ --output-dir site/api
2
+ --protected
3
+ --readme README.md
4
+ lib
5
+ -
6
+ [A-Z]*.*
7
+
data/Assembly ADDED
@@ -0,0 +1,46 @@
1
+ ---
2
+ github:
3
+ active: true
4
+
5
+ gem:
6
+ active: true
7
+
8
+ dnote:
9
+ labels: ~
10
+ output: log/NOTES.rdoc
11
+
12
+ yard:
13
+ yardopts: true
14
+
15
+ qed:
16
+ files : ~
17
+ #exclude : ~
18
+ #loadpath: ~
19
+ #requires: ~
20
+ #live : false
21
+ active : false
22
+
23
+ qedoc:
24
+ files : spec/
25
+ output: QED.rdoc
26
+ active: false
27
+
28
+ vclog:
29
+ output: log/ChangeLog.rdoc
30
+ active: false
31
+
32
+ email:
33
+ service: Email
34
+ file : ~
35
+ subject: ~
36
+ mailto :
37
+ - ruby-talk@ruby-lang.org
38
+ - rubyworks-mailinglist@googlegroups.com
39
+ from : <%= ENV['EMAIL_ACCOUNT'] %>
40
+ server : <%= ENV['EMAIL_SERVER'] %>
41
+ port : <%= ENV['EMAIL_PORT'] %>
42
+ account: <%= ENV['EMAIL_ACCOUNT'] %>
43
+ domain : <%= ENV['EMAIL_DOMAIN'] %>
44
+ login : <%= ENV['EMAIL_LOGIN'] %>
45
+ secure : <%= ENV['EMAIL_SECURE'] %>
46
+
data/COPYING.rdoc ADDED
@@ -0,0 +1,31 @@
1
+ = COPYRIGHT NOTICES
2
+
3
+ == Ruby Test
4
+
5
+ Copyright:: (c) 2011 Thomas Sawyer, RubyWorks
6
+ License:: BSD-2-Clause
7
+ Website:: http://rubyworks.github.com/ruby-test
8
+
9
+ Copyright 2011 Thomas Sawyer. All rights reserved.
10
+
11
+ Redistribution and use in source and binary forms, with or without
12
+ modification, are permitted provided that the following conditions are met:
13
+
14
+ 1. Redistributions of source code must retain the above copyright notice,
15
+ this list of conditions and the following disclaimer.
16
+
17
+ 2. Redistributions in binary form must reproduce the above copyright
18
+ notice, this list of conditions and the following disclaimer in the
19
+ documentation and/or other materials provided with the distribution.
20
+
21
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
23
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
+ COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
28
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+
data/HISTORY.md ADDED
@@ -0,0 +1,29 @@
1
+ # RELEASE HISTORY
2
+
3
+ ## 0.2.0 / 2011-08-10
4
+
5
+ With this release Ruby Test is essentially feature complete. Of course there
6
+ are plenty of tweaks and improvements yet to come, but Ruby Test is fully usable
7
+ at this point. Only one major aspect of the design remains in question --the
8
+ way per-testcase "before and after all" advice is handled. Other than that
9
+ the API fairly solid, even as this early state of development. Always helps
10
+ when you have a spec to go by!
11
+
12
+ Changes:
13
+
14
+ * Use Config class to look-up .test file.
15
+ * Support hard testing, topic and pre-case setup.
16
+ * Add autorun.rb runner script.
17
+ * Add a test reporter to use for testing Ruby Test itself.
18
+ * Improved dotprogess reporter's handling of omissions.
19
+ * Add unit selection to test runner.
20
+
21
+
22
+ ## 0.1.0 / 2011-07-30
23
+
24
+ First release of Ruby Test.
25
+
26
+ Changes:
27
+
28
+ * It's Your Birthday!
29
+
data/LICENSE.txt ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2 Clause License
2
+
3
+ Copyright 2011 Thomas Sawyer. All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
18
+ COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
19
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+
data/MANIFEST ADDED
@@ -0,0 +1,38 @@
1
+ #!mast .ruby .test .yaropts bin lib spec test [A-Z][A-Z]*
2
+ .ruby
3
+ .test
4
+ bin/ruby-test
5
+ lib/test/autorun.rb
6
+ lib/test/cli.rb
7
+ lib/test/code_snippet.rb
8
+ lib/test/config.rb
9
+ lib/test/core_ext/assertion.rb
10
+ lib/test/core_ext/exception.rb
11
+ lib/test/core_ext/string.rb
12
+ lib/test/core_ext.rb
13
+ lib/test/rake.rb
14
+ lib/test/recorder.rb
15
+ lib/test/reporters/abstract.rb
16
+ lib/test/reporters/abstract_hash.rb
17
+ lib/test/reporters/dotprogress.rb
18
+ lib/test/reporters/html.rb
19
+ lib/test/reporters/outline.rb
20
+ lib/test/reporters/progress.rb
21
+ lib/test/reporters/summary.rb
22
+ lib/test/reporters/tap.rb
23
+ lib/test/reporters/tapj.rb
24
+ lib/test/reporters/tapy.rb
25
+ lib/test/reporters/test.rb
26
+ lib/test/runner.rb
27
+ lib/test.rb
28
+ spec/01_test.md
29
+ spec/02_case.md
30
+ spec/applique/ruby-test.rb
31
+ test/basic_case.rb
32
+ PROFILE
33
+ LICENSE.txt
34
+ HISTORY.md
35
+ HISTORY.md.bak
36
+ README.md
37
+ VERSION
38
+ COPYING.rdoc
data/PROFILE ADDED
@@ -0,0 +1,31 @@
1
+ ---
2
+ name : test
3
+ title : Ruby Test
4
+ summary: Ruby Universal Test Harness
5
+ created: 2011-07-23
6
+
7
+ description:
8
+ Ruby Test is a universal test harness for Ruby.
9
+ It can handle any compliant test framework,
10
+ even running tests from multiple frameworks
11
+ in a single pass.
12
+
13
+ authors:
14
+ - Thomas Sawyer <transfire@gmail.com>
15
+
16
+ requirements:
17
+ - ansi
18
+ - detroit (build)
19
+ - qed (test)
20
+
21
+ resources:
22
+ home: http://rubyworks.github.com/test
23
+ code: http://github.com/rubyworks/test
24
+ mail: http://groups.google.com/group/rubyworks-mailinglist
25
+
26
+ repositories:
27
+ upstream: git@github.com:rubyworks/test.git
28
+
29
+ copyrights:
30
+ - 2011 Thomas Sawyer, RubyWorks (FreeBSD)
31
+
data/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # Ruby Test
2
+
3
+ [Homepage](http://rubyworks.github.com/test) &middot;
4
+ [User Guide](http://wiki.github.com/rubyworks/test) &middot;
5
+ [Development](http://github.com/rubyworks/test) &middot;
6
+ [Issues](http://github.com/rubyworks/test/issues)
7
+
8
+ ## Description
9
+
10
+ Ruby Test is a universal test harness for use by any Ruby test framework.
11
+ It defines a simple specification for compliance, which allows Ruby Test
12
+ to run the framework's tests, and even test across multiple frameworks
13
+ in a single pass.
14
+
15
+ ## Specification
16
+
17
+ Ruby Test defines a straight-forward specification that any test framework can
18
+ easily support which allows Ruby Test to run the frameworks tests through a
19
+ single uniform user interface.
20
+
21
+ The universal access point for testing is the `$TEST_SUITE` global array. A test
22
+ framework need only add compliant test objects to `$TEST_SUITE`.
23
+ Ruby Test will iterate through these objects. If a test object responds to
24
+ `#call`, it is run as a test procedure. If it responds to `#each` it is iterated
25
+ over as a test case with each entry handled in the same manner. All test
26
+ objects must respond to `#to_s` so their description can be used in test
27
+ reports.
28
+
29
+ Any raised exception that responds to `#assertion?` in the affirmative is taken
30
+ to be a failed assertion rather than simply an error. Ruby Test extends the
31
+ Exception class to support this method for all exceptions.
32
+
33
+ A test framework may raise a `NotImplementedError` to have a test recorded
34
+ as "pending" --a _todo_ item to remind the developer of tests that still
35
+ need to be written. The `NotImplementedError` is a standard Ruby exception
36
+ and a subclass of `ScriptError`.
37
+
38
+ If the `NotImplmentedError` responds in the affirmative to `#assertion?` then
39
+ the test is taken to be a purposeful _omission_, rather than simply pending.
40
+
41
+ That is the crux of Ruby Test specification. Ruby Test supports some
42
+ additional features that can makes its usage even more convenient.
43
+ See the [Wiki](http://github.com/rubyworks/test/wiki) for further details.
44
+
45
+
46
+ ## Usage
47
+
48
+ There are a few ways to run tests. First, there is a command line tool:
49
+
50
+ $ ruby-test
51
+
52
+ The command line tool takes various options, use `--help` to see them.
53
+ Be sure to load in your test framework or framework's Ruby Test adapter.
54
+
55
+ Preconfigurations can be defined in a `.test` file, e.g.
56
+
57
+ Test.run 'default' do |r|
58
+ r.format = 'progress'
59
+ r.requires << 'lemon'
60
+ r.files << 'test/*_case.rb'
61
+ end
62
+
63
+ There is a 'test/autorun.rb' library script can be loaded which creates an
64
+ `at_exit` procedure.
65
+
66
+ $ ruby -rtest/autorun
67
+
68
+ And there is a Rake task.
69
+
70
+ require 'test/rake'
71
+
72
+ A Detroit plugin is in the works and should be available soon.
73
+
74
+
75
+ ## Installation
76
+
77
+ Ruby Test is available as Gem package.
78
+
79
+ $ gem install test
80
+
81
+
82
+ ## Requirements
83
+
84
+ Ruby test uses the [ANSI](http://rubyworks.github.com/ansi) gem for color output.
85
+
86
+ Because of the "foundational" nature of this library we will look at removing
87
+ this dependencies for future versions, but for early development the
88
+ requirements does the job and does it well.
89
+
90
+
91
+ ## Development
92
+
93
+ Ruby Test is still a "nuby" gem. Please feel OBLIGATED to help improve it ;-)
94
+
95
+ Ruby Test is a [RubyWorks](http://rubyworks.github.com) project. If you can't
96
+ contribue code, you can still help out by contributing to our development fund.
97
+
98
+
99
+ ## Reference Material
100
+
101
+ [1] [Standard Definition Of Unit Test](http://c2.com/cgi/wiki?StandardDefinitionOfUnitTest)
102
+
103
+
104
+ ## Copyrights
105
+
106
+ Copyright (c) 2011 Thomas Sawyer, Rubyworks
107
+
108
+ Made available according to the terms of the <b>FreeBSD license</b>.
109
+
110
+ See COPYING.rdoc for details.