regtest 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.aspell.pws +2 -1
- data/Changelog +5 -0
- data/LICENSE +1 -1
- data/Rakefile +0 -1
- data/lib/regtest.rb +4 -3
- data/lib/regtest/colorize.rb +3 -43
- data/lib/regtest/colors.rb +63 -0
- data/lib/regtest/task.rb +0 -4
- data/lib/regtest/version.rb +1 -1
- data/regtest.gemspec +11 -14
- data/regtest/metatest_git.rb +2 -1
- metadata +8 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f5b02a7c607d5735101137dcc7e5bac179d8edb3be167ff73b8b68d0dee9e4b0
|
4
|
+
data.tar.gz: 317570205b1fabd4134fcf8760a5cea3205b9b52f9a4e8275b0d786f782a1ebe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7af88f7231a95bc5b98544bcd22f6b9a2e6ee8fd5fea378a86dcf80a344ca4d0dedd13d9bd2777cc15362802dd887e05abe70330bdb5c7b1bcc8ad4d6753d00c
|
7
|
+
data.tar.gz: d3f6c5f59cbf50915b6f8ce54f56713f0a60bdf8bd54c9a0120a1c2ca4a7884a51fc2d967d9cc6d0e87280d600e8be104b1f4f6b8852130e69c548cf2dbeece6
|
data/.aspell.pws
CHANGED
data/Changelog
CHANGED
data/LICENSE
CHANGED
data/Rakefile
CHANGED
data/lib/regtest.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Regtest - Simple Regression Testing With Ruby
|
5
5
|
#
|
6
|
-
# Copyright 2014, 2015, 2017 by Jan Friedrich <janfri26@gmail.com>
|
6
|
+
# Copyright 2014, 2015, 2017-2019 by Jan Friedrich <janfri26@gmail.com>
|
7
7
|
# License: Regtest is licensed under the same terms as Ruby itself.
|
8
8
|
#
|
9
9
|
|
@@ -13,7 +13,7 @@ require 'yaml'
|
|
13
13
|
|
14
14
|
module Regtest
|
15
15
|
|
16
|
-
@start =
|
16
|
+
@start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
17
17
|
@results = {}
|
18
18
|
@exit_codes = Hash.new(1)
|
19
19
|
@exit_codes.merge!({success: 0, unknown_result: 1, fail: 2})
|
@@ -80,7 +80,8 @@ module Regtest
|
|
80
80
|
|
81
81
|
# Report some statistics, could be overwritten by plugins.
|
82
82
|
def report_statistics
|
83
|
-
|
83
|
+
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
84
|
+
time = now - start
|
84
85
|
sample_count = results.values.map(&:size).reduce(0, &:+)
|
85
86
|
report format("\n\n%d samples executed in %.2f s (%d samples/s)", sample_count, time, sample_count / time), type: :statistics
|
86
87
|
end
|
data/lib/regtest/colorize.rb
CHANGED
@@ -1,48 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
module Regtest
|
4
|
+
require 'regtest/colors'
|
6
5
|
|
7
|
-
|
8
|
-
# It uses the great colorize gem
|
9
|
-
# (see https://rubygems.org/gems/colorize)
|
10
|
-
module Colorize
|
6
|
+
Regtest::Colorize = Regtest::Colors
|
11
7
|
|
12
|
-
|
13
|
-
@mapping[:statistics] = {mode: :italic}
|
14
|
-
|
15
|
-
class << self
|
16
|
-
# Color mapping (all parameters of ColorizedString.colorize are supported
|
17
|
-
# (see https://github.com/fazibear/colorize#usage)
|
18
|
-
# Examples:
|
19
|
-
# Regtest::Colorize.mapping[:filename] = :light_blue
|
20
|
-
# Regtest::Colorize.mapping[:statistics] = {color: :cyan, mode: :italic}
|
21
|
-
attr_accessor :mapping
|
22
|
-
end
|
23
|
-
|
24
|
-
require 'colorized_string'
|
25
|
-
# If loading of colorized_string (gem colorize) fails the accessor above is
|
26
|
-
# available in .regtestrc files but method redefinition of Regtest.report and
|
27
|
-
# prepending of Colorize is skipped.
|
28
|
-
|
29
|
-
# Redefine Regtest.report.
|
30
|
-
def report *args, type: nil
|
31
|
-
color = Colorize.mapping[type]
|
32
|
-
if color && $stdout.tty?
|
33
|
-
args = args.map {|a| ColorizedString[a.to_s].colorize(color)}
|
34
|
-
end
|
35
|
-
puts *args
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
class << self
|
41
|
-
prepend Colorize
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
rescue LoadError
|
46
|
-
warn 'gem colorize not found'
|
47
|
-
warn 'plugin regtest/colorize disabled'
|
48
|
-
end
|
8
|
+
warn 'regtest/colorize is deprecated. use regtest/colors instead.'
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Regtest
|
5
|
+
|
6
|
+
module Colors
|
7
|
+
|
8
|
+
# Redefine Regtest.report
|
9
|
+
def report *args, type: nil
|
10
|
+
color = Colors.mapping[type]
|
11
|
+
if color && $stdout.tty?
|
12
|
+
args = args.map {|a| Colors.apply(a.to_s, color)}
|
13
|
+
end
|
14
|
+
puts *args
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
# Color mapping
|
19
|
+
# Examples:
|
20
|
+
# Regtest::Colors.mapping[:filename] = :lightblue
|
21
|
+
# Regtest::Colors.mapping[:fail] = :@red # '@' prefix means background color
|
22
|
+
# Regtest::Colors.mapping[:statistics] = %i(cyan italic) # more than one color code is possible
|
23
|
+
attr_accessor :mapping
|
24
|
+
|
25
|
+
# Apply color codes to a string
|
26
|
+
def apply str, *codes
|
27
|
+
codes.flatten.each do |c|
|
28
|
+
num = @codes[c.to_sym]
|
29
|
+
fail format('Code %s not supported.', c) unless num
|
30
|
+
str = format("\e[%dm%s", num, str)
|
31
|
+
end
|
32
|
+
format("%s\e[0m", str)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Get available color codes
|
36
|
+
def codes
|
37
|
+
@codes.keys
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
@mapping = (%i(success fail unknown_result filename).zip %i(green red yellow blue)).to_h
|
44
|
+
@codes = {}
|
45
|
+
|
46
|
+
%i(bold faint italic underline).each_with_index do |mode, i|
|
47
|
+
@codes[mode] = 1 + i
|
48
|
+
end
|
49
|
+
|
50
|
+
%i(black red green yellow blue magenta cyan white).each_with_index do |color, i|
|
51
|
+
@codes[color] = 30 + i
|
52
|
+
@codes[format('@%s', color).to_sym] = 40 + i
|
53
|
+
@codes[format('light%s', color).to_sym] = 90 + i
|
54
|
+
@codes[format('@light%s', color).to_sym] = 100 + i
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
class << self
|
60
|
+
prepend Colors
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
data/lib/regtest/task.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
|
-
#
|
4
|
-
# Copyright 2014, 2016, 2017 by Jan Friedrich <janfri26@gmail.com>
|
5
|
-
# License: Regtest is licensed under the same terms as Ruby itself.
|
6
|
-
#
|
7
3
|
|
8
4
|
# Regtest sample files (= Ruby files)
|
9
5
|
REGTEST_FILES_RB = FileList.new('regtest/**/*.rb')
|
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.1.0 ruby lib
|
3
3
|
#
|
4
4
|
# This file is automatically generated by rim.
|
5
5
|
# PLEASE DO NOT EDIT IT DIRECTLY!
|
@@ -7,39 +7,36 @@
|
|
7
7
|
|
8
8
|
Gem::Specification.new do |s|
|
9
9
|
s.name = "regtest"
|
10
|
-
s.version = "2.
|
10
|
+
s.version = "2.1.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 = "
|
15
|
+
s.date = "2019-03-04"
|
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 = ["./.aspell.pws", "Changelog", "Gemfile", "LICENSE", "README.md", "Rakefile", "lib/regtest", "lib/regtest.rb", "lib/regtest/colorize.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/metatest.rb", "regtest/metatest.yml", "regtest/metatest_git.rb", "regtest/metatest_git.yml", "regtest/no_samples.rb"]
|
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 = "2.6
|
22
|
+
s.rubygems_version = "2.7.6"
|
23
23
|
s.summary = "Simple regression testing with Ruby."
|
24
24
|
|
25
25
|
if s.respond_to? :specification_version then
|
26
26
|
s.specification_version = 4
|
27
27
|
|
28
28
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
29
|
-
s.add_runtime_dependency(%q<colorize>, ["~> 0.8"])
|
30
29
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
31
|
-
s.add_development_dependency(%q<rim>, ["~> 2.
|
32
|
-
s.add_development_dependency(%q<regtest>, ["~>
|
30
|
+
s.add_development_dependency(%q<rim>, ["~> 2.17"])
|
31
|
+
s.add_development_dependency(%q<regtest>, ["~> 2"])
|
33
32
|
else
|
34
|
-
s.add_dependency(%q<colorize>, ["~> 0.8"])
|
35
33
|
s.add_dependency(%q<rake>, [">= 0"])
|
36
|
-
s.add_dependency(%q<rim>, ["~> 2.
|
37
|
-
s.add_dependency(%q<regtest>, ["~>
|
34
|
+
s.add_dependency(%q<rim>, ["~> 2.17"])
|
35
|
+
s.add_dependency(%q<regtest>, ["~> 2"])
|
38
36
|
end
|
39
37
|
else
|
40
|
-
s.add_dependency(%q<colorize>, ["~> 0.8"])
|
41
38
|
s.add_dependency(%q<rake>, [">= 0"])
|
42
|
-
s.add_dependency(%q<rim>, ["~> 2.
|
43
|
-
s.add_dependency(%q<regtest>, ["~>
|
39
|
+
s.add_dependency(%q<rim>, ["~> 2.17"])
|
40
|
+
s.add_dependency(%q<regtest>, ["~> 2"])
|
44
41
|
end
|
45
42
|
end
|
data/regtest/metatest_git.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: regtest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.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:
|
11
|
+
date: 2019-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: colorize
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.8'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0.8'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rake
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +30,28 @@ dependencies:
|
|
44
30
|
requirements:
|
45
31
|
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
33
|
+
version: '2.17'
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
40
|
+
version: '2.17'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: regtest
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
47
|
+
version: '2'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
54
|
+
version: '2'
|
69
55
|
description: |
|
70
56
|
This library supports a very simple way to do regression testing with Ruby. It
|
71
57
|
is not limited to Ruby projects you can use it also in other contexts where you
|
@@ -93,6 +79,7 @@ files:
|
|
93
79
|
- Rakefile
|
94
80
|
- lib/regtest.rb
|
95
81
|
- lib/regtest/colorize.rb
|
82
|
+
- lib/regtest/colors.rb
|
96
83
|
- lib/regtest/git.rb
|
97
84
|
- lib/regtest/task.rb
|
98
85
|
- lib/regtest/version.rb
|
@@ -128,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
115
|
version: '0'
|
129
116
|
requirements: []
|
130
117
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.6
|
118
|
+
rubygems_version: 2.7.6
|
132
119
|
signing_key:
|
133
120
|
specification_version: 4
|
134
121
|
summary: Simple regression testing with Ruby.
|