regtest 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.aspell.pws +38 -0
- data/Changelog +7 -0
- data/README.md +80 -0
- data/lib/regtest.rb +80 -52
- data/lib/regtest/version.rb +1 -1
- data/regtest.gemspec +5 -5
- data/regtest/log.log +3 -0
- data/regtest/log.rb +14 -0
- data/regtest/log.yml +3 -0
- data/regtest/log_append.log +4 -0
- data/regtest/log_append.rb +32 -0
- data/regtest/log_append.yml +18 -0
- data/regtest/log_rewrite.log +1 -0
- data/regtest/log_rewrite.rb +32 -0
- data/regtest/log_rewrite.yml +12 -0
- data/regtest/metatest.yml +9 -1
- data/regtest/metatest_git.yml +74 -6
- data/regtest/no_samples.rb +1 -1
- data/regtest/toplevel.log +1 -0
- data/regtest/toplevel.rb +30 -0
- data/regtest/toplevel.yml +28 -0
- metadata +16 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dade806646767b2c8b5deaca696d849a629add7c09bc27fbacb741c402c2ff51
|
4
|
+
data.tar.gz: e869f521c91d7d8546ad1e48ac2df5804bad9635b64383a8f8ab27ea5688571c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d62e5e02737461d2a79b844935357ad71c7c744bee6992a470e67b743d1a8fb123c34c78318b19025e1581e3571d75687b76cb7d8d1ad120f5adac8926d1836
|
7
|
+
data.tar.gz: 076042c8d2dd51711c2459b51b40bedde4d6b782fd53b15227103094fb560b50b5bbc00412ee7cb641053ec07cd5e714152726fa36e30cc6155c96faea1cfa0b
|
data/.aspell.pws
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
personal_ws-1.1 en 26
|
2
|
+
Bugfix
|
3
|
+
ENV
|
4
|
+
Friedrich
|
5
|
+
Gemfile
|
6
|
+
NOREGTESTRC
|
7
|
+
README
|
8
|
+
Regtest
|
9
|
+
SCM
|
10
|
+
SemVer
|
11
|
+
SemVerTag
|
12
|
+
YAML
|
13
|
+
basename
|
14
|
+
bitbucket
|
15
|
+
dir
|
16
|
+
exiftool
|
17
|
+
gettime
|
18
|
+
github
|
19
|
+
md
|
20
|
+
metatest
|
21
|
+
metatests
|
22
|
+
rb
|
23
|
+
rc
|
24
|
+
regtest
|
25
|
+
regtestrc
|
26
|
+
scripref
|
27
|
+
yml
|
28
|
+
arg
|
29
|
+
Matz
|
30
|
+
ary
|
31
|
+
Matz
|
32
|
+
OpenStruct
|
33
|
+
Rakefile
|
34
|
+
arg
|
35
|
+
ary
|
36
|
+
catched
|
37
|
+
ostruct
|
38
|
+
yaml
|
data/Changelog
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
2.2.0
|
2
|
+
Add a new method Regtest.log to allow the logging of temporary values which
|
3
|
+
could be of interest for different reasons (i. e. debugging).
|
4
|
+
With this version you can use `extend Regtest` to have the methods sample, log
|
5
|
+
and combinations as top level methods. This is experimental and therefore not
|
6
|
+
yet mentioned at README.
|
7
|
+
|
1
8
|
2.1.1
|
2
9
|
Adapt remaining examples of regtest/colorize to regtest/colors.
|
3
10
|
|
data/README.md
CHANGED
@@ -146,6 +146,79 @@ older runs of the samples is done by your SCM. So the sample files and their
|
|
146
146
|
corresponding results files should be taken under version control.
|
147
147
|
|
148
148
|
|
149
|
+
## Logging
|
150
|
+
|
151
|
+
The key idea behind regtest is to produce values that are invariant and check
|
152
|
+
if this assumption is true at another (mostly later) state of code. But often
|
153
|
+
there are temporary or specific values which changes or could change at each
|
154
|
+
run of regtest. This could be for example an id for a created record or the
|
155
|
+
version of a used external service or some time-relevant values. Sometimes it
|
156
|
+
is be useful, to know the actual value of one of these.
|
157
|
+
|
158
|
+
In such cases the method ```Regtest.log``` could be handy. It writes a line of
|
159
|
+
the given object to a log file which is named with the same name as the calling
|
160
|
+
Ruby script but has as extension ```.log```. It could be called inside as well
|
161
|
+
as outside of a regtest sample. Per default this file is overwritten by the
|
162
|
+
first call of ```Regtest.log``` of each run of regtest and per file. And each
|
163
|
+
further call of ```Regtest.log``` appends then to the file. So you get a
|
164
|
+
complete log for each run. But this behaviour could be changed with the
|
165
|
+
```mode``` keyword arg of the method. Let's see an example:
|
166
|
+
|
167
|
+
```ruby
|
168
|
+
Regtest.log RUBY_VERSION
|
169
|
+
|
170
|
+
def create_record **values
|
171
|
+
# do stuff to create the record and return the id of the generated record
|
172
|
+
end
|
173
|
+
|
174
|
+
def delete_record id
|
175
|
+
# delete an existing record or raise an exception if record with id doesn't
|
176
|
+
# exists
|
177
|
+
end
|
178
|
+
|
179
|
+
Regtest.sample 'create a record and delete it' do
|
180
|
+
id = create_record language: 'Ruby', creator: 'Matz'
|
181
|
+
Regtest.log "generated record with id #{id}"
|
182
|
+
delete_record id
|
183
|
+
# the generated id should not be part of the result, because it changes every
|
184
|
+
# time you create a new record
|
185
|
+
'Record created and deleted'
|
186
|
+
end
|
187
|
+
|
188
|
+
Regtest.sample 'try to delete a non existing record' do
|
189
|
+
delete_record -1
|
190
|
+
end
|
191
|
+
```
|
192
|
+
|
193
|
+
If you want to have a log that is not truncated at each run of regtest, you can
|
194
|
+
use ```mode: 'a'```at the first call of ```Regtest.log``` in the corresponding
|
195
|
+
ruby script.
|
196
|
+
|
197
|
+
```ruby
|
198
|
+
# ...
|
199
|
+
# the first call of Regtest.log in this Ruby file
|
200
|
+
Regtest.log Time.now, mode: 'a'
|
201
|
+
```
|
202
|
+
|
203
|
+
On the other hand, you can use ```mode: 'w'``` to truncate the log file even at
|
204
|
+
a later call of ```Regtest.log```.
|
205
|
+
|
206
|
+
```ruby
|
207
|
+
max_time = 0
|
208
|
+
ary.each do |e|
|
209
|
+
t = get_time_to_do_some_stuff
|
210
|
+
if t > max_time
|
211
|
+
max_time = t
|
212
|
+
Regtest.log max_time, mode: 'w'
|
213
|
+
# the content of the corresponding log file is now one line with max_time
|
214
|
+
end
|
215
|
+
end
|
216
|
+
```
|
217
|
+
|
218
|
+
Because the log files contains only temporary stuff they should normally not
|
219
|
+
checked in the SCM.
|
220
|
+
|
221
|
+
|
149
222
|
## Configuration and Plugins
|
150
223
|
|
151
224
|
You can adapt the behaviour of regtest with plugins. To configure this and
|
@@ -225,6 +298,13 @@ The code is hosted on [github](https://github.com/janfri/regtest) and
|
|
225
298
|
[bitbucket](https://bitbucket.org/janfri/regtest) Change it to your needs.
|
226
299
|
Release a fork. It is open source.
|
227
300
|
|
301
|
+
|
302
|
+
## Versioning
|
303
|
+
|
304
|
+
Regtest follows [Semantic Versioning](https://semver.org/), both SemVer and
|
305
|
+
SemVerTag.
|
306
|
+
|
307
|
+
|
228
308
|
## Author
|
229
309
|
|
230
310
|
Jan Friedrich <janfri26@gmail.com>
|
data/lib/regtest.rb
CHANGED
@@ -9,73 +9,101 @@
|
|
9
9
|
|
10
10
|
require 'ostruct'
|
11
11
|
require 'regtest/version'
|
12
|
+
require 'set'
|
12
13
|
require 'yaml'
|
13
14
|
|
14
15
|
module Regtest
|
15
16
|
|
17
|
+
extend self
|
18
|
+
|
16
19
|
@start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
17
20
|
@results = {}
|
21
|
+
@log_filenames = Set.new
|
18
22
|
@exit_codes = Hash.new(1)
|
19
23
|
@exit_codes.merge!({success: 0, unknown_result: 1, fail: 2})
|
20
24
|
|
21
|
-
|
25
|
+
# Define a sample
|
26
|
+
def sample name
|
27
|
+
h = {}
|
28
|
+
name = name.to_s if name.kind_of?(Symbol)
|
29
|
+
h['sample'] = name
|
30
|
+
begin
|
31
|
+
h['result'] = yield
|
32
|
+
rescue Exception => e
|
33
|
+
h['exception'] = e.message
|
34
|
+
end
|
35
|
+
output_filename = Regtest.determine_filename_from_caller('.yml')
|
36
|
+
unless Regtest.results[output_filename]
|
37
|
+
Regtest.report "\n", type: :filename unless Regtest.results.empty?
|
38
|
+
Regtest.report output_filename, type: :filename
|
39
|
+
Regtest.results[output_filename] = []
|
40
|
+
end
|
41
|
+
Regtest.results[output_filename] << h
|
42
|
+
print '.'; $stdout.flush
|
43
|
+
h
|
44
|
+
end
|
22
45
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
46
|
+
# Build all combinations of a Hash-like object with arrays as values.
|
47
|
+
# Return value is an array of OpenStruct instances.
|
48
|
+
#
|
49
|
+
# Example:
|
50
|
+
# require 'ostruct'
|
51
|
+
# require 'regtest'
|
52
|
+
#
|
53
|
+
# o = OpenStruct.new
|
54
|
+
# o.a = [1,2,3]
|
55
|
+
# o.b = [:x, :y]
|
56
|
+
# Regtest.combinations(o)
|
57
|
+
# # => [#<OpenStruct a=1, b=:x>, #<OpenStruct a=1, b=:y>,
|
58
|
+
# # #<OpenStruct a=2, b=:x>, #<OpenStruct a=2, b=:y>,
|
59
|
+
# # #<OpenStruct a=3, b=:x>, #<OpenStruct a=3, b=:y>]
|
60
|
+
def combinations hashy
|
61
|
+
h = hashy.to_h
|
62
|
+
a = h.values[0].product(*h.values[1..-1])
|
63
|
+
res = []
|
64
|
+
a.each do |e|
|
65
|
+
o = OpenStruct.new
|
66
|
+
h.keys.zip(e) do |k, v|
|
67
|
+
o[k] = v
|
40
68
|
end
|
41
|
-
|
42
|
-
print '.'; $stdout.flush
|
43
|
-
h
|
69
|
+
res << o
|
44
70
|
end
|
71
|
+
res
|
72
|
+
end
|
45
73
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
def combinations hashy
|
61
|
-
h = hashy.to_h
|
62
|
-
a = h.values[0].product(*h.values[1..-1])
|
63
|
-
res = []
|
64
|
-
a.each do |e|
|
65
|
-
o = OpenStruct.new
|
66
|
-
h.keys.zip(e) do |k, v|
|
67
|
-
o[k] = v
|
68
|
-
end
|
69
|
-
res << o
|
70
|
-
end
|
71
|
-
res
|
74
|
+
# Write (temporary) informations to a log file
|
75
|
+
# By default the log file is truncated at the first call of Regtest.log for
|
76
|
+
# each run of regtest, and all following calls appends to the log file. So
|
77
|
+
# you have a log for one run of regtest. You can use mode ('a' or 'w') to
|
78
|
+
# change this behaviour for each call of Regtest.log.
|
79
|
+
def log s, mode: nil
|
80
|
+
log_filename = Regtest.determine_filename_from_caller('.log')
|
81
|
+
case mode
|
82
|
+
when nil
|
83
|
+
mode = Regtest.log_filenames.include?(log_filename) ? 'a' : 'w'
|
84
|
+
when 'a', 'w'
|
85
|
+
# ok
|
86
|
+
else
|
87
|
+
raise ArgumentError.new("Mode #{mode} is not allowed.")
|
72
88
|
end
|
89
|
+
Regtest.log_filenames << log_filename
|
90
|
+
File.open log_filename, mode do |f|
|
91
|
+
f.puts s
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
class << self
|
96
|
+
|
97
|
+
attr_reader :exit_codes, :log_filenames, :results, :start
|
73
98
|
|
74
|
-
# Determine
|
75
|
-
#
|
76
|
-
|
77
|
-
|
78
|
-
|
99
|
+
# Determine a filename which is derived from the filename of the "real"
|
100
|
+
# caller of the calling method
|
101
|
+
# @param ext new extension (i.e. '.yml')
|
102
|
+
def determine_filename_from_caller ext
|
103
|
+
cls = caller_locations
|
104
|
+
base_label = cls.first.base_label
|
105
|
+
cls = cls.drop_while {|cl| cl.base_label == base_label}
|
106
|
+
cls.first.path.sub(/\.rb$/, '') << ext.to_s
|
79
107
|
end
|
80
108
|
|
81
109
|
# Report some statistics, could be overwritten by plugins.
|
data/lib/regtest/version.rb
CHANGED
data/regtest.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: regtest 2.
|
2
|
+
# stub: regtest 2.2.0 ruby lib
|
3
3
|
#
|
4
4
|
# This file is automatically generated by rim.
|
5
5
|
# PLEASE DO NOT EDIT IT DIRECTLY!
|
@@ -7,19 +7,19 @@
|
|
7
7
|
|
8
8
|
Gem::Specification.new do |s|
|
9
9
|
s.name = "regtest"
|
10
|
-
s.version = "2.
|
10
|
+
s.version = "2.2.0"
|
11
11
|
|
12
12
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
13
13
|
s.require_paths = ["lib"]
|
14
14
|
s.authors = ["Jan Friedrich"]
|
15
|
-
s.date = "2019-
|
15
|
+
s.date = "2019-12-20"
|
16
16
|
s.description = "This library supports a very simple way to do regression testing with Ruby. It\nis not limited to Ruby projects you can use it also in other contexts where you\ncan extract data with Ruby.\n\nYou write Ruby scripts with samples. Run these and get the sample results as\nresults files besides your scripts. Check both the scripts and the results\nfiles in you Source Code Management System (SCM). When you run the scrips on a\nlater (or even previous) version of your code a simple diff show you if and how\nthe changes in your code or environment impact the results of your samples.\n\nThis is not a replacement for unit testing but a complement: You can produce a\nlot of samples with a small amount of Ruby code (e.g. a large number of\ncombinations of data).\n"
|
17
17
|
s.email = "janfri26@gmail.com"
|
18
|
-
s.files = ["Changelog", "Gemfile", "LICENSE", "README.md", "Rakefile", "lib/regtest", "lib/regtest.rb", "lib/regtest/colorize.rb", "lib/regtest/colors.rb", "lib/regtest/git.rb", "lib/regtest/task.rb", "lib/regtest/version.rb", "regtest.gemspec", "regtest/combinations.rb", "regtest/combinations.yml", "regtest/examples.rb", "regtest/examples.yml", "regtest/filename with spaces.rb", "regtest/filename with spaces.yml", "regtest/metatest.rb", "regtest/metatest.yml", "regtest/metatest_git.rb", "regtest/metatest_git.yml", "regtest/no_samples.rb"]
|
18
|
+
s.files = ["./.aspell.pws", "Changelog", "Gemfile", "LICENSE", "README.md", "Rakefile", "lib/regtest", "lib/regtest.rb", "lib/regtest/colorize.rb", "lib/regtest/colors.rb", "lib/regtest/git.rb", "lib/regtest/task.rb", "lib/regtest/version.rb", "regtest.gemspec", "regtest/combinations.rb", "regtest/combinations.yml", "regtest/examples.rb", "regtest/examples.yml", "regtest/filename with spaces.rb", "regtest/filename with spaces.yml", "regtest/log.log", "regtest/log.rb", "regtest/log.yml", "regtest/log_append.log", "regtest/log_append.rb", "regtest/log_append.yml", "regtest/log_rewrite.log", "regtest/log_rewrite.rb", "regtest/log_rewrite.yml", "regtest/metatest.rb", "regtest/metatest.yml", "regtest/metatest_git.rb", "regtest/metatest_git.yml", "regtest/no_samples.rb", "regtest/toplevel.log", "regtest/toplevel.rb", "regtest/toplevel.yml"]
|
19
19
|
s.homepage = "https://github.com/janfri/regtest"
|
20
20
|
s.licenses = ["Ruby"]
|
21
21
|
s.required_ruby_version = Gem::Requirement.new(">= 2.1.0")
|
22
|
-
s.rubygems_version = "
|
22
|
+
s.rubygems_version = "3.0.3"
|
23
23
|
s.summary = "Simple regression testing with Ruby."
|
24
24
|
|
25
25
|
if s.respond_to? :specification_version then
|
data/regtest/log.log
ADDED
data/regtest/log.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'regtest'
|
5
|
+
|
6
|
+
Regtest.sample 'test' do
|
7
|
+
a = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
8
|
+
Regtest.log a
|
9
|
+
b = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
10
|
+
Regtest.log b
|
11
|
+
a < b
|
12
|
+
end
|
13
|
+
|
14
|
+
Regtest.log 'Logging from outside of a sample works.'
|
data/regtest/log.yml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'regtest'
|
5
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
|
8
|
+
$log_filename = __FILE__.sub(/\.rb$/, '.log')
|
9
|
+
|
10
|
+
# set the initial content of the log file
|
11
|
+
File.open($log_filename, 'w') do |f|
|
12
|
+
f.puts 'initial line'
|
13
|
+
end
|
14
|
+
|
15
|
+
def lines_of_log_file
|
16
|
+
File.readlines($log_filename).map(&:chomp) # keyword chomp is not supported by Ruby versions < 2.4
|
17
|
+
end
|
18
|
+
|
19
|
+
Regtest.sample 'first log entry appends to file' do
|
20
|
+
Regtest.log 'first log entry', mode: 'a'
|
21
|
+
lines_of_log_file
|
22
|
+
end
|
23
|
+
|
24
|
+
Regtest.sample 'second log entry appends to file' do
|
25
|
+
Regtest.log 'second log entry'
|
26
|
+
lines_of_log_file
|
27
|
+
end
|
28
|
+
|
29
|
+
Regtest.sample 'third log entry appends to file' do
|
30
|
+
Regtest.log 'first log entry', mode: 'a'
|
31
|
+
lines_of_log_file
|
32
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
sample: first log entry appends to file
|
3
|
+
result:
|
4
|
+
- initial line
|
5
|
+
- first log entry
|
6
|
+
---
|
7
|
+
sample: second log entry appends to file
|
8
|
+
result:
|
9
|
+
- initial line
|
10
|
+
- first log entry
|
11
|
+
- second log entry
|
12
|
+
---
|
13
|
+
sample: third log entry appends to file
|
14
|
+
result:
|
15
|
+
- initial line
|
16
|
+
- first log entry
|
17
|
+
- second log entry
|
18
|
+
- first log entry
|
@@ -0,0 +1 @@
|
|
1
|
+
third log entry
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'regtest'
|
5
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
|
8
|
+
$log_filename = __FILE__.sub(/\.rb$/, '.log')
|
9
|
+
|
10
|
+
# set the initial content of the log file
|
11
|
+
File.open($log_filename, 'w') do |f|
|
12
|
+
f.puts 'initial line'
|
13
|
+
end
|
14
|
+
|
15
|
+
def lines_of_log_file
|
16
|
+
File.readlines($log_filename).map(&:chomp) # keyword chomp is not supported by Ruby versions < 2.4
|
17
|
+
end
|
18
|
+
|
19
|
+
Regtest.sample 'first log entry rewrites log file' do
|
20
|
+
Regtest.log 'first log entry'
|
21
|
+
lines_of_log_file
|
22
|
+
end
|
23
|
+
|
24
|
+
Regtest.sample 'second log entry rewrites log file' do
|
25
|
+
Regtest.log 'second log entry', mode: 'w'
|
26
|
+
lines_of_log_file
|
27
|
+
end
|
28
|
+
|
29
|
+
Regtest.sample 'third log entry rewrites log file' do
|
30
|
+
Regtest.log 'third log entry', mode: 'w'
|
31
|
+
lines_of_log_file
|
32
|
+
end
|
data/regtest/metatest.yml
CHANGED
@@ -8,8 +8,16 @@ result:
|
|
8
8
|
...
|
9
9
|
filename with spaces.yml
|
10
10
|
.
|
11
|
+
log.yml
|
12
|
+
.
|
13
|
+
log_append.yml
|
14
|
+
...
|
15
|
+
log_rewrite.yml
|
16
|
+
...
|
17
|
+
toplevel.yml
|
18
|
+
.....
|
11
19
|
|
12
|
-
|
20
|
+
22 samples executed in x.xx s (x samples/s)
|
13
21
|
|
14
22
|
Please check result files manually. Regtest isn't able to do that.
|
15
23
|
stderr: ''
|
data/regtest/metatest_git.yml
CHANGED
@@ -8,13 +8,25 @@ result:
|
|
8
8
|
...
|
9
9
|
filename with spaces.yml
|
10
10
|
.
|
11
|
+
log.yml
|
12
|
+
.
|
13
|
+
log_append.yml
|
14
|
+
...
|
15
|
+
log_rewrite.yml
|
16
|
+
...
|
17
|
+
toplevel.yml
|
18
|
+
.....
|
11
19
|
|
12
|
-
|
20
|
+
22 samples executed in x.xx s (x samples/s)
|
13
21
|
|
14
22
|
There is at least one new sample result file.
|
15
23
|
?? combinations.yml
|
16
24
|
?? examples.yml
|
17
25
|
?? filename with spaces.yml
|
26
|
+
?? log.yml
|
27
|
+
?? log_append.yml
|
28
|
+
?? log_rewrite.yml
|
29
|
+
?? toplevel.yml
|
18
30
|
stderr: ''
|
19
31
|
exitstatus: 1
|
20
32
|
---
|
@@ -27,13 +39,25 @@ result:
|
|
27
39
|
...
|
28
40
|
filename with spaces.yml
|
29
41
|
.
|
42
|
+
log.yml
|
43
|
+
.
|
44
|
+
log_append.yml
|
45
|
+
...
|
46
|
+
log_rewrite.yml
|
47
|
+
...
|
48
|
+
toplevel.yml
|
49
|
+
.....
|
30
50
|
|
31
|
-
|
51
|
+
22 samples executed in x.xx s (x samples/s)
|
32
52
|
|
33
53
|
There is at least one new sample result file.
|
34
54
|
A combinations.yml
|
35
55
|
A examples.yml
|
36
56
|
?? filename with spaces.yml
|
57
|
+
?? log.yml
|
58
|
+
?? log_append.yml
|
59
|
+
?? log_rewrite.yml
|
60
|
+
?? toplevel.yml
|
37
61
|
stderr: ''
|
38
62
|
exitstatus: 1
|
39
63
|
---
|
@@ -46,13 +70,25 @@ result:
|
|
46
70
|
....
|
47
71
|
filename with spaces.yml
|
48
72
|
.
|
73
|
+
log.yml
|
74
|
+
.
|
75
|
+
log_append.yml
|
76
|
+
...
|
77
|
+
log_rewrite.yml
|
78
|
+
...
|
79
|
+
toplevel.yml
|
80
|
+
.....
|
49
81
|
|
50
|
-
|
82
|
+
23 samples executed in x.xx s (x samples/s)
|
51
83
|
|
52
84
|
There are changes in your sample results!
|
53
85
|
A combinations.yml
|
54
86
|
AM examples.yml
|
55
87
|
?? filename with spaces.yml
|
88
|
+
?? log.yml
|
89
|
+
?? log_append.yml
|
90
|
+
?? log_rewrite.yml
|
91
|
+
?? toplevel.yml
|
56
92
|
stderr: ''
|
57
93
|
exitstatus: 2
|
58
94
|
---
|
@@ -65,12 +101,24 @@ result:
|
|
65
101
|
....
|
66
102
|
filename with spaces.yml
|
67
103
|
.
|
104
|
+
log.yml
|
105
|
+
.
|
106
|
+
log_append.yml
|
107
|
+
...
|
108
|
+
log_rewrite.yml
|
109
|
+
...
|
110
|
+
toplevel.yml
|
111
|
+
.....
|
68
112
|
|
69
|
-
|
113
|
+
23 samples executed in x.xx s (x samples/s)
|
70
114
|
|
71
115
|
There are changes in your sample results!
|
72
116
|
M examples.yml
|
73
117
|
?? filename with spaces.yml
|
118
|
+
?? log.yml
|
119
|
+
?? log_append.yml
|
120
|
+
?? log_rewrite.yml
|
121
|
+
?? toplevel.yml
|
74
122
|
stderr: ''
|
75
123
|
exitstatus: 2
|
76
124
|
---
|
@@ -83,12 +131,24 @@ result:
|
|
83
131
|
....
|
84
132
|
filename with spaces.yml
|
85
133
|
.
|
134
|
+
log.yml
|
135
|
+
.
|
136
|
+
log_append.yml
|
137
|
+
...
|
138
|
+
log_rewrite.yml
|
139
|
+
...
|
140
|
+
toplevel.yml
|
141
|
+
.....
|
86
142
|
|
87
|
-
|
143
|
+
23 samples executed in x.xx s (x samples/s)
|
88
144
|
|
89
145
|
Looks good. :)
|
90
146
|
M examples.yml
|
91
147
|
A "filename with spaces.yml"
|
148
|
+
A log.yml
|
149
|
+
A log_append.yml
|
150
|
+
A log_rewrite.yml
|
151
|
+
A toplevel.yml
|
92
152
|
stderr: ''
|
93
153
|
exitstatus: 0
|
94
154
|
---
|
@@ -101,8 +161,16 @@ result:
|
|
101
161
|
....
|
102
162
|
filename with spaces.yml
|
103
163
|
.
|
164
|
+
log.yml
|
165
|
+
.
|
166
|
+
log_append.yml
|
167
|
+
...
|
168
|
+
log_rewrite.yml
|
169
|
+
...
|
170
|
+
toplevel.yml
|
171
|
+
.....
|
104
172
|
|
105
|
-
|
173
|
+
23 samples executed in x.xx s (x samples/s)
|
106
174
|
|
107
175
|
Looks good. :)
|
108
176
|
stderr: ''
|
data/regtest/no_samples.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
0.9128981855032113
|
data/regtest/toplevel.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'regtest'
|
5
|
+
|
6
|
+
methods_before = methods
|
7
|
+
|
8
|
+
extend Regtest
|
9
|
+
|
10
|
+
methods_after = methods
|
11
|
+
|
12
|
+
Regtest.sample "Toplevel methods defined by 'extend Regtest'" do
|
13
|
+
(methods_after - methods_before).map(&:to_s).sort
|
14
|
+
end
|
15
|
+
|
16
|
+
Regtest.sample 'metatest' do
|
17
|
+
sample 'sample works at toplevel' do
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Regtest.sample 'combinations work at toplevel' do
|
23
|
+
combinations(x: %w(a b), y: [1,2]).map(&:to_h)
|
24
|
+
end
|
25
|
+
|
26
|
+
Regtest.sample 'log works at toplevel' do
|
27
|
+
f = rand.to_s
|
28
|
+
log f
|
29
|
+
File.read(__FILE__.sub(/\.rb$/, '.log')).chomp == f
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
sample: Toplevel methods defined by 'extend Regtest'
|
3
|
+
result:
|
4
|
+
- combinations
|
5
|
+
- log
|
6
|
+
- sample
|
7
|
+
---
|
8
|
+
sample: sample works at toplevel
|
9
|
+
result: true
|
10
|
+
---
|
11
|
+
sample: metatest
|
12
|
+
result:
|
13
|
+
sample: sample works at toplevel
|
14
|
+
result: true
|
15
|
+
---
|
16
|
+
sample: combinations work at toplevel
|
17
|
+
result:
|
18
|
+
- :x: a
|
19
|
+
:y: 1
|
20
|
+
- :x: a
|
21
|
+
:y: 2
|
22
|
+
- :x: b
|
23
|
+
:y: 1
|
24
|
+
- :x: b
|
25
|
+
:y: 2
|
26
|
+
---
|
27
|
+
sample: log works at toplevel
|
28
|
+
result: true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: regtest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Friedrich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -71,6 +71,7 @@ executables: []
|
|
71
71
|
extensions: []
|
72
72
|
extra_rdoc_files: []
|
73
73
|
files:
|
74
|
+
- "./.aspell.pws"
|
74
75
|
- Changelog
|
75
76
|
- Gemfile
|
76
77
|
- LICENSE
|
@@ -89,11 +90,23 @@ files:
|
|
89
90
|
- regtest/examples.yml
|
90
91
|
- regtest/filename with spaces.rb
|
91
92
|
- regtest/filename with spaces.yml
|
93
|
+
- regtest/log.log
|
94
|
+
- regtest/log.rb
|
95
|
+
- regtest/log.yml
|
96
|
+
- regtest/log_append.log
|
97
|
+
- regtest/log_append.rb
|
98
|
+
- regtest/log_append.yml
|
99
|
+
- regtest/log_rewrite.log
|
100
|
+
- regtest/log_rewrite.rb
|
101
|
+
- regtest/log_rewrite.yml
|
92
102
|
- regtest/metatest.rb
|
93
103
|
- regtest/metatest.yml
|
94
104
|
- regtest/metatest_git.rb
|
95
105
|
- regtest/metatest_git.yml
|
96
106
|
- regtest/no_samples.rb
|
107
|
+
- regtest/toplevel.log
|
108
|
+
- regtest/toplevel.rb
|
109
|
+
- regtest/toplevel.yml
|
97
110
|
homepage: https://github.com/janfri/regtest
|
98
111
|
licenses:
|
99
112
|
- Ruby
|
@@ -113,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
126
|
- !ruby/object:Gem::Version
|
114
127
|
version: '0'
|
115
128
|
requirements: []
|
116
|
-
rubygems_version: 3.
|
129
|
+
rubygems_version: 3.0.3
|
117
130
|
signing_key:
|
118
131
|
specification_version: 4
|
119
132
|
summary: Simple regression testing with Ruby.
|