test 0.2.1 → 0.3.1

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/HISTORY.md DELETED
@@ -1,29 +0,0 @@
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
-
@@ -1,25 +0,0 @@
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 DELETED
@@ -1,37 +0,0 @@
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
- README.md
36
- VERSION
37
- COPYING.rdoc
data/PROFILE DELETED
@@ -1,31 +0,0 @@
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 DELETED
@@ -1,110 +0,0 @@
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.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.1
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'test/cli'
3
- Test::Runner.cli(*ARGV)
4
-
@@ -1,3 +0,0 @@
1
- # TODO: Should we have test.rb file?
2
-
3
- require 'test/autorun'
@@ -1,18 +0,0 @@
1
- $TEST_SUITE = [] unless defined?($TEST_SUITE)
2
-
3
- at_exit {
4
- if RUBY_VERSION < '1.9'
5
- require 'test/runner'
6
- else
7
- require_relative 'runner'
8
- end
9
-
10
- suite = $TEST_SUITE
11
- options = {
12
- :format => ENV['ruby-test-format'] # TODO: better name?
13
- }
14
-
15
- runner = Test::Runner.new(suite, options)
16
- success = runner.run
17
- exit -1 unless success
18
- }
@@ -1,110 +0,0 @@
1
- module Test
2
-
3
- require 'test/config'
4
- require 'test/runner'
5
-
6
- # Command line interface.
7
- class Runner
8
-
9
- # Test runner command line interface.
10
- #
11
- def self.cli(*argv)
12
- runner = new
13
-
14
- Test::Config.load
15
-
16
- cli_options(runner, argv)
17
-
18
- begin
19
- # Add standard location if it exists.
20
- $LOAD_PATH.unshift(File.expand_path('lib')) if File.directory?('lib')
21
-
22
- success = runner.run
23
- exit -1 unless success
24
- rescue => error
25
- raise error if $DEBUG
26
- $stderr.puts('ERROR: ' + error.to_s)
27
- end
28
- end
29
-
30
- #
31
- def self.cli_options(runner, argv)
32
- require 'optparse'
33
-
34
- config = Test.config.dup
35
- config_loaded = false
36
-
37
- common = config.delete('common')
38
- default = config.delete('default')
39
-
40
- common.call(runner) if common
41
-
42
- OptionParser.new do |opt|
43
- opt.banner = "Usage: #{$0} [options] [files ...]"
44
-
45
- unless config.empty?
46
- opt.separator "PRESET OPTIONS:"
47
- config.each do |name, block|
48
- opt.on("--#{name}") do
49
- block.call(runner)
50
- end
51
- end
52
- end
53
-
54
- opt.separator "CONFIG OPTIONS:"
55
-
56
- opt.on '-f', '--format NAME', 'report format' do |name|
57
- runner.format = name
58
- end
59
- opt.on '-y', '--tapy', 'shortcut for -f tapy' do
60
- runner.format = 'tapy'
61
- end
62
- opt.on '-j', '--tapj', 'shortcut for -f tapj' do
63
- runner.format = 'tapj'
64
- end
65
-
66
- opt.on '-t', '--tag TAG', 'select tests by tag' do |tag|
67
- runner.tags << tag
68
- end
69
- opt.on '-u', '--unit TAG', 'select tests by software unit' do |unit|
70
- runner.units << unit
71
- end
72
- opt.on '-m', '--match TEXT', 'select tests by description' do |text|
73
- runner.match << text
74
- end
75
-
76
- opt.on '-I', '--loadpath PATH', 'add to $LOAD_PATH' do |paths|
77
- paths.split(/[:;]/).reverse_each do |path|
78
- $LOAD_PATH.unshift path
79
- end
80
- end
81
- opt.on '-r', '--require FILE', 'require file' do |file|
82
- require file
83
- end
84
- opt.on '-v' , '--verbose', 'provide extra detailed report' do
85
- runner.verbose = true
86
- end
87
- #opt.on('--log DIRECTORY', 'log directory'){ |dir|
88
- # options[:log] = dir
89
- #}
90
- opt.on_tail("--[no-]ansi" , 'turn on/off ANSI colors'){ |v| $ansi = v }
91
- opt.on_tail("--debug" , 'turn on debugging mode'){ $DEBUG = true }
92
- #opt.on_tail("--about" , 'display information about lemon'){
93
- # puts "Ruby Test v#{VERSION}"
94
- # puts "#{COPYRIGHT}"
95
- # exit
96
- #}
97
- opt.on_tail('-h', '--help', 'display this help message'){
98
- puts opt
99
- exit
100
- }
101
- end.parse!(argv)
102
-
103
- default.call(runner) if default && !config_loaded
104
-
105
- runner.files.replace(argv) unless argv.empty?
106
- end
107
-
108
- end
109
-
110
- end
@@ -1,93 +0,0 @@
1
- module Test
2
-
3
- # Thanks goes to Suraj N. Kurapati for the origins of this code.
4
- #
5
- class CodeSnippet
6
-
7
- def self.cache(file)
8
- @cache ||= {}
9
- @cache[file] ||= File.readlines(file)
10
- end
11
-
12
- #
13
- def self.from_backtrace(backtrace)
14
- backtrace.first =~ /(.+?):(\d+(?=:|\z))/ or return ""
15
- file, line = $1, $2.to_i
16
- new(file, line)
17
- end
18
-
19
- #
20
- def self.from_error(exception)
21
- backtrace = exception.backtrace
22
- from_backtrace(backtrace)
23
- end
24
-
25
- #
26
- def initialize(file, line)
27
- @file = file
28
- @line = line || 1
29
- @code = CodeSnippet.cache(file)
30
- end
31
-
32
- #
33
- attr :file
34
-
35
- #
36
- attr :line
37
-
38
- #
39
- attr :code
40
-
41
- #
42
- alias :source :code
43
-
44
- #
45
- def to_str
46
- code[line-1].strip
47
- end
48
-
49
- #
50
- #--
51
- # TODO: ensure proper alignment by zero-padding line numbers
52
- #++
53
- def to_s(radius=2)
54
- r = range(radius)
55
- f = " %2s %0#{r.last.to_s.length}d %s"
56
- r.map do |n|
57
- f % [('=>' if n == line), n, code[n-1].chomp]
58
- end.join("\n")
59
- end
60
-
61
- #
62
- def to_a(radius=2)
63
- r = range(radius)
64
- r.map do |n|
65
- code[n-1].chomp
66
- end
67
- end
68
-
69
- #
70
- def to_omap(radius=2)
71
- a = []
72
- r = range(radius)
73
- r.each do |n|
74
- a << {n => code[n-1].chomp}
75
- end
76
- a
77
- end
78
-
79
- #
80
- def succ
81
- line += 1
82
- end
83
-
84
- private
85
-
86
- #
87
- def range(radius)
88
- [line - radius, 1].max..[line + radius, source.length].min
89
- end
90
-
91
- end
92
-
93
- end