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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 28b2ce644b776836dc3a87811ecc3c8accc4365e
4
- data.tar.gz: 64b940c2ab67af77fb2bbbf205abdd2e4122f0c1
2
+ SHA256:
3
+ metadata.gz: f5b02a7c607d5735101137dcc7e5bac179d8edb3be167ff73b8b68d0dee9e4b0
4
+ data.tar.gz: 317570205b1fabd4134fcf8760a5cea3205b9b52f9a4e8275b0d786f782a1ebe
5
5
  SHA512:
6
- metadata.gz: c1bb833f9ae90d7cbbcbb63c503b72a6341df21728378aebabdb4ebcee97168b4567fbf6ca3185ee738434e986f7671f75a207df5d9aed9bcd1f5d151fef7337
7
- data.tar.gz: ab381db6009de48d6698aeca01fcc550b3cc860022ecc88880942270ba4731509ee109273d94b43479635707c95a410679499dacf9554d2ca888a73e4d1430dd
6
+ metadata.gz: 7af88f7231a95bc5b98544bcd22f6b9a2e6ee8fd5fea378a86dcf80a344ca4d0dedd13d9bd2777cc15362802dd887e05abe70330bdb5c7b1bcc8ad4d6753d00c
7
+ data.tar.gz: d3f6c5f59cbf50915b6f8ce54f56713f0a60bdf8bd54c9a0120a1c2ca4a7884a51fc2d967d9cc6d0e87280d600e8be104b1f4f6b8852130e69c548cf2dbeece6
@@ -1,4 +1,4 @@
1
- personal_ws-1.1 en 26
1
+ personal_ws-1.1 en 27
2
2
  NOREGTESTRC
3
3
  md
4
4
  dir
@@ -25,3 +25,4 @@ regtestrc
25
25
  metatest
26
26
  README
27
27
  OpenStruct
28
+ gettime
data/Changelog CHANGED
@@ -1,3 +1,8 @@
1
+ 2.1.0
2
+ Use Process.clock_gettime for time measurements.
3
+ Eliminate dependency to colorize gem. So Regtest has no longer any
4
+ dependency.
5
+
1
6
  2.0.0 Major Release
2
7
 
3
8
  Incompatibilities to regtest 1.x
data/LICENSE CHANGED
@@ -1,3 +1,3 @@
1
- Copyright 2014-2017 by Jan Friedrich <janfri26@gmail.com>
1
+ Copyright 2014, 2015, 2017-2019 by Jan Friedrich <janfri26@gmail.com>
2
2
 
3
3
  Regtest is licensed under the same terms as Ruby itself.
data/Rakefile CHANGED
@@ -34,7 +34,6 @@ Rim.setup do |p|
34
34
  END
35
35
  p.homepage = 'https://github.com/janfri/regtest'
36
36
  p.ruby_version = '>=2.1.0'
37
- p.dependencies << %w(colorize ~>0.8)
38
37
  end
39
38
 
40
39
  # JRuby does not support escaping of filenames with spaces in Open3.capture3
@@ -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 = Time.now
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
- time = Time.now - start
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
@@ -1,48 +1,8 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
 
4
- begin
5
- module Regtest
4
+ require 'regtest/colors'
6
5
 
7
- # Regtest plugin to have colorized reports.
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
- @mapping = (%i(success fail unknown_result filename).zip %i(green red yellow blue)).to_h
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
@@ -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')
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Regtest
5
- VERSION = '2.0.0'
5
+ VERSION = '2.1.0'
6
6
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: regtest 2.0.0 ruby lib
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.0.0"
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 = "2017-09-22"
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.13"
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.15"])
32
- s.add_development_dependency(%q<regtest>, ["~> 1.0"])
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.15"])
37
- s.add_dependency(%q<regtest>, ["~> 1.0"])
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.15"])
43
- s.add_dependency(%q<regtest>, ["~> 1.0"])
39
+ s.add_dependency(%q<rim>, ["~> 2.17"])
40
+ s.add_dependency(%q<regtest>, ["~> 2"])
44
41
  end
45
42
  end
@@ -3,10 +3,11 @@
3
3
 
4
4
  # If git isn't available skip this file
5
5
  begin
6
+ require 'open3'
6
7
  Open3.capture2e('git --version')
7
8
 
8
9
  require 'fileutils'
9
- require 'open3'
10
+ require 'regtest'
10
11
  require 'regtest/git'
11
12
  require 'tmpdir'
12
13
 
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.0.0
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: 2017-09-22 00:00:00.000000000 Z
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.15'
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.15'
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: '1.0'
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: '1.0'
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.13
118
+ rubygems_version: 2.7.6
132
119
  signing_key:
133
120
  specification_version: 4
134
121
  summary: Simple regression testing with Ruby.