test_bench 1.2.0.1 → 1.2.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0b85e1c148836b5c471f896d1dab75c3a2e795f23a6aeec0efdec897e680b41
4
- data.tar.gz: e00508806675ebe425e429332da6bf86fd0ab0cb2dac4cb04d39c78a92dc1005
3
+ metadata.gz: e3b488668e7e9d65b4a0ec2adbabb94b9a1cf8e4a29d9e4b1c90b5b3c867fd59
4
+ data.tar.gz: 9d4034e73a32b4d694197a1f3ee6a89c9c7843288cdf23934e9aeea4e4136ce8
5
5
  SHA512:
6
- metadata.gz: bf94c5541130fcbb6debe9684ae3d43edd3c86e64de0f7019c983da4e5752e276f502f20735675391439dad1fd58a60dc8fdfc6a8e82d7e268c550eac8841a87
7
- data.tar.gz: dbba2a36f1a2ca185cea48dfb0c20e542e1895c1abee01738cb128c2f97ddc312b71dd122099bb03a732f5b64ce7864e2178bdc3e30b7d57a907028c9cc18c48
6
+ metadata.gz: 2b49bf38f0ed60504849c6e726fdcbf372d8700b459b1357d967ea472ae76f9ce0ff06c2eef60f0ce438843e5a540c431c80ab9ecc44f6a2f4de18179056e3b0
7
+ data.tar.gz: 770d4bf06d1048be6d031a11ce2040f16275296d731f01052dac9ded7632c587424b7af317c94c3b55acbcc1988e9ff93045724fb88c3307aa2614504bc09f8d
@@ -1,4 +1,6 @@
1
- require 'optionparser'
1
+ unless RUBY_ENGINE == 'mruby'
2
+ require 'optionparser'
3
+ end
2
4
 
3
5
  require 'test_bench/fixture'
4
6
 
@@ -48,15 +48,15 @@ module TestBench
48
48
  parser.on('-h', '--help', "Print this help message and exit successfully") do
49
49
  output_device.puts(parser.help)
50
50
 
51
- exit(true)
51
+ raise SystemExit.new(0)
52
52
  end
53
53
 
54
54
  parser.on('-V', '--version', "Print version and exit successfully") do
55
- output_device.puts <<~TEXT
56
- test-bench (#{self.class.program_name}) version #{self.class.version}
57
- TEXT
55
+ output_device.puts <<TEXT
56
+ test-bench (#{self.class.program_name}) version #{self.class.version}
57
+ TEXT
58
58
 
59
- exit(true)
59
+ raise SystemExit.new(0)
60
60
  end
61
61
 
62
62
  parser.separator('')
@@ -128,29 +128,29 @@ module TestBench
128
128
  env['TEST_BENCH_VERBOSE'] = verbose ? 'on' : 'off'
129
129
  end
130
130
 
131
- parser.separator(<<~TEXT)
131
+ parser.separator(<<TEXT)
132
132
 
133
- Paths to test files (and directories containing test files) can be given after any command line arguments or via STDIN (or both).
134
- If no paths are given, a default path (#{Defaults.tests_directory}) is scanned for test files.
133
+ Paths to test files (and directories containing test files) can be given after any command line arguments or via STDIN (or both).
134
+ If no paths are given, a default path (#{Defaults.tests_directory}) is scanned for test files.
135
135
 
136
- The following environment variables can also control execution:
136
+ The following environment variables can also control execution:
137
137
 
138
- #{parser.summary_indent}TEST_BENCH_ABORT_ON_ERROR Same as -a or --abort-on-error
139
- #{parser.summary_indent}TEST_BENCH_DETAIL Same as -d or --detail
140
- #{parser.summary_indent}TEST_BENCH_EXCLUDE_FILE_PATTERN Same as -x or --exclude-file-pattern
141
- #{parser.summary_indent}TEST_BENCH_LOG_LEVEL Same as -l or --log-level
142
- #{parser.summary_indent}TEST_BENCH_OMIT_BACKTRACE_PATTERN Same as -o or --omit-backtrace-pattern
143
- #{parser.summary_indent}TEST_BENCH_OUTPUT_STYLING Same as -s or --output-styling
144
- #{parser.summary_indent}TEST_BENCH_FAIL_DEACTIVATED_TESTS Opposite of -p or --permit-deactivated-tests
145
- #{parser.summary_indent}TEST_BENCH_REVERSE_BACKTRACES Same as -r or --reverse-backtraces
146
- #{parser.summary_indent}TEST_BENCH_VERBOSE Same as -v or --reverse-backtraces
138
+ #{parser.summary_indent}TEST_BENCH_ABORT_ON_ERROR Same as -a or --abort-on-error
139
+ #{parser.summary_indent}TEST_BENCH_DETAIL Same as -d or --detail
140
+ #{parser.summary_indent}TEST_BENCH_EXCLUDE_FILE_PATTERN Same as -x or --exclude-file-pattern
141
+ #{parser.summary_indent}TEST_BENCH_LOG_LEVEL Same as -l or --log-level
142
+ #{parser.summary_indent}TEST_BENCH_OMIT_BACKTRACE_PATTERN Same as -o or --omit-backtrace-pattern
143
+ #{parser.summary_indent}TEST_BENCH_OUTPUT_STYLING Same as -s or --output-styling
144
+ #{parser.summary_indent}TEST_BENCH_FAIL_DEACTIVATED_TESTS Opposite of -p or --permit-deactivated-tests
145
+ #{parser.summary_indent}TEST_BENCH_REVERSE_BACKTRACES Same as -r or --reverse-backtraces
146
+ #{parser.summary_indent}TEST_BENCH_VERBOSE Same as -v or --reverse-backtraces
147
147
 
148
- TEXT
148
+ TEXT
149
149
  end
150
150
  end
151
151
 
152
152
  def assure_pattern(pattern_text)
153
- Regexp.new(pattern_text)
153
+ Regexp.new(pattern_text.to_s)
154
154
  rescue RegexpError
155
155
  raise Error, "Invalid regular expression pattern (Pattern: #{pattern_text.inspect})"
156
156
  end
@@ -164,7 +164,7 @@ module TestBench
164
164
  end
165
165
 
166
166
  def self.version
167
- if defined?(Gem)
167
+ if Object.const_defined?(:Gem)
168
168
  spec = Gem.loaded_specs['test_bench']
169
169
  end
170
170
 
@@ -1,4 +1,6 @@
1
- require 'securerandom'
1
+ unless RUBY_ENGINE == 'mruby'
2
+ require 'securerandom'
3
+ end
2
4
 
3
5
  require 'test_bench/fixture/controls'
4
6
 
@@ -11,11 +11,11 @@ module TestBench
11
11
 
12
12
  error = Error.example(message)
13
13
 
14
- <<~TEXT
15
- #{indent}#{error.backtrace[0]}: #{error.message} (#{error.class.name})
16
- \t#{indent}from #{error.backtrace[1]}
17
- \t#{indent}from #{error.backtrace[2]}
18
- TEXT
14
+ <<TEXT
15
+ #{indent}#{error.backtrace[0]}: #{error.message} (#{error.class.name})
16
+ \t#{indent}from #{error.backtrace[1]}
17
+ \t#{indent}from #{error.backtrace[2]}
18
+ TEXT
19
19
  end
20
20
 
21
21
  module Assertion
@@ -24,9 +24,9 @@ module TestBench
24
24
 
25
25
  assertion_failure = TestBench::Fixture::AssertionFailure.build(caller_location)
26
26
 
27
- <<~TEXT
28
- #{assertion_failure.backtrace[0]}: #{assertion_failure.message} (#{assertion_failure.class.name})
29
- TEXT
27
+ <<TEXT
28
+ #{assertion_failure.backtrace[0]}: #{assertion_failure.message} (#{assertion_failure.class.name})
29
+ TEXT
30
30
  end
31
31
  end
32
32
  end
@@ -3,7 +3,12 @@ module TestBench
3
3
  module Output
4
4
  module NewlineCharacter
5
5
  def self.example
6
- StringIO.new.tap(&:puts).string
6
+ str = String.new
7
+
8
+ string_io = StringIO.new(str)
9
+ string_io.puts('')
10
+
11
+ str
7
12
  end
8
13
  end
9
14
  end
@@ -5,12 +5,12 @@ module TestBench
5
5
  module Error
6
6
  module Text
7
7
  def self.example
8
- <<~TEXT
9
- Error Summary:
10
- 1: #{file}
11
- #{error.backtrace[0]}: #{error} (#{error.class})
8
+ <<TEXT
9
+ Error Summary:
10
+ 1: #{file}
11
+ #{error.backtrace[0]}: #{error} (#{error.class})
12
12
 
13
- TEXT
13
+ TEXT
14
14
  end
15
15
 
16
16
  def self.file
@@ -5,12 +5,12 @@ module TestBench
5
5
  module Session
6
6
  module Text
7
7
  def self.example
8
- <<~TEXT
9
- Finished running 0 files
10
- Ran 0 tests in 0.000s (0.0 tests/second)
11
- 0 passed, 0 skipped, 0 failed, 0 total errors
8
+ <<TEXT
9
+ Finished running 0 files
10
+ Ran 0 tests in 0.000s (0.0 tests/second)
11
+ 0 passed, 0 skipped, 0 failed, 0 total errors
12
12
 
13
- TEXT
13
+ TEXT
14
14
  end
15
15
  end
16
16
  end
@@ -12,9 +12,19 @@ module TestBench
12
12
  minutes = self.minutes
13
13
  seconds = self.seconds + seconds_offset
14
14
 
15
- tz_offset = self.tz_offset
15
+ if not RUBY_ENGINE == 'mruby'
16
+ tz_offset = self.tz_offset
16
17
 
17
- ::Time.new(year, month, day, hours, minutes, seconds, tz_offset)
18
+ final_argument = tz_offset
19
+ else
20
+ seconds, subseconds = seconds.divmod(1)
21
+
22
+ microseconds = subseconds * 1_000_000
23
+
24
+ final_argument = microseconds
25
+ end
26
+
27
+ ::Time.new(year, month, day, hours, minutes, seconds, final_argument)
18
28
  end
19
29
 
20
30
  def self.year
@@ -1,3 +1,5 @@
1
- require 'ostruct'
1
+ unless RUBY_ENGINE == 'mruby'
2
+ require 'ostruct'
3
+ end
2
4
 
3
5
  require 'test_bench/fixtures/configure_receiver'
@@ -8,7 +8,7 @@ module TestBench
8
8
 
9
9
  class Timer < Timer
10
10
  def elapsed_time
11
- @elapsed_time ||= 0
11
+ @elapsed_time ||= 0.0
12
12
  end
13
13
  attr_writer :elapsed_time
14
14
 
@@ -106,7 +106,7 @@ module TestBench
106
106
 
107
107
  def newline
108
108
  sync
109
- device.puts
109
+ device.puts('')
110
110
  self.byte_offset += 1
111
111
  self
112
112
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_bench
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.1
4
+ version: 1.2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Ladd
8
8
  autorequire:
9
9
  bindir: script
10
10
  cert_chain: []
11
- date: 2020-08-08 00:00:00.000000000 Z
11
+ date: 2020-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test_bench-fixture