test_bench-bootstrap 7.0.1 → 7.0.3

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: 3f087797e1a30457e627a843f823e8b5fddbd1dacaeef4848496498c4e9b028b
4
- data.tar.gz: 912ce4dbed032e4bcd26cf1bcf946bea2e71419238aef22107a1382710a22575
3
+ metadata.gz: 7412ef4171fcd3ca6c2f107a6c142fc21b62c241645ca0d755036a561af990a6
4
+ data.tar.gz: d6c044ba850463a046b23efc9c9dd278fb8f1bbd80173de53e5c403d8c964bdf
5
5
  SHA512:
6
- metadata.gz: 9b08dfe19230cf4046d319a2e51e770120c33c26aa9ab12fabd4e652f7caabbe2b4c708331b8664ec7b6d5a10f7f66043337ff2f2baac44530df4ce998c51682
7
- data.tar.gz: e8a7cd2466d56651c4a2f74a2bd114d70a33e5ff1dd09db3a5c1960d1cf9b3f58521762bc827a472b0d7266495dee79a4fe3f34eec61ddb140aaa9d7cafb89dc
6
+ metadata.gz: 6e5c2167c135b3acf049106bcbef63b1ac711fea22999cc438bee449a2a73b6aca36254b4efa59b48a9b42842a1e35427cb9bcf58367ed0d6aba28c1204af961
7
+ data.tar.gz: 55d2693ad764722f7615e007bf95a3c136bb8f7da3a54cf9ed418a8928046df570cfc85d9f6a7384f5b8018512d21e9394ef21568d2871ba248b5e2340ac0f18
@@ -28,6 +28,12 @@ module TestBenchBootstrap
28
28
  arguments ||= ::ARGV
29
29
  env ||= ::ENV
30
30
 
31
+ options_env_var = env['TEST_BENCH_OPTIONS']
32
+ if not options_env_var.nil?
33
+ env_arguments = Shellwords.split(options_env_var)
34
+ arguments.unshift(*env_arguments)
35
+ end
36
+
31
37
  instance = new(arguments)
32
38
 
33
39
  instance.env = env
@@ -90,9 +96,9 @@ module TestBenchBootstrap
90
96
  ].compact.join(':')
91
97
 
92
98
  when '-d', '--detail'
93
- env['TEST_BENCH_OUTPUT_DETAIL'] = 'on'
99
+ env['TEST_BENCH_DETAIL'] = 'on'
94
100
  when '-D', '--no-detail'
95
- env['TEST_BENCH_OUTPUT_DETAIL'] = 'off'
101
+ env['TEST_BENCH_DETAIL'] = 'off'
96
102
 
97
103
  when '--device'
98
104
  device = require_next_argument(switch)
@@ -203,11 +209,12 @@ module TestBenchBootstrap
203
209
  TEST_BENCH_STRICT See --strict
204
210
  TEST_BENCH_RANDOM_SEED See --random-seed
205
211
  TEST_BENCH_FILTER_BACKTRACE_PATTERN See --filter-backtrace
206
- TEST_BENCH_OUTPUT_DETAIL See --detail
212
+ TEST_BENCH_DETAIL See --detail
207
213
  TEST_BENCH_OUTPUT_DEVICE See --device
208
214
  TEST_BENCH_OUTPUT_LEVEL See --output-level
209
215
  TEST_BENCH_OUTPUT_STYLING See --output-styling
210
216
  TEST_BENCH_DEFAULT_TEST_PATH Specifies default path
217
+ TEST_BENCH_OPTIONS Evaluated as command line arguments similar to RUBYOPT
211
218
 
212
219
  TEXT
213
220
  exit(true)
@@ -1,3 +1,5 @@
1
+ require 'test_bench_bootstrap/shellwords'
2
+
1
3
  require 'test_bench_bootstrap/test_bench/run'
2
4
 
3
5
  require 'test_bench_bootstrap/test_bench/executable/defaults'
@@ -548,7 +548,7 @@ module TestBenchBootstrap
548
548
 
549
549
  module Defaults
550
550
  def self.detail_policy
551
- env_var_value = ENV.fetch('TEST_BENCH_OUTPUT_DETAIL', 'failure')
551
+ env_var_value = ENV.fetch('TEST_BENCH_DETAIL', 'failure')
552
552
 
553
553
  detail_policy = env_var_value.to_sym
554
554
 
@@ -31,10 +31,12 @@ module TestBenchBootstrap
31
31
 
32
32
  module Styling
33
33
  def self.example
34
+ backtrace = AbsolutePaths::Local::Backtrace.example(styling: true)
35
+
34
36
  [
35
- Exception::Example.backtrace.first,
37
+ backtrace.first,
36
38
  "\e[2;3m*omitted*\e[23;22m",
37
- Exception::Example.backtrace.last
39
+ backtrace.last
38
40
  ]
39
41
  end
40
42
  end
@@ -66,13 +68,37 @@ module TestBenchBootstrap
66
68
  end
67
69
 
68
70
  def self.backtrace
69
- Exception::AbsolutePaths::Example.backtrace_locations.map do |backtrace_location|
70
- backtrace_location.to_s.delete_prefix(::File.join(apex_directory, ''))
71
- end
71
+ Backtrace.example
72
72
  end
73
73
 
74
74
  def self.apex_directory
75
- Path::ApexDirectory.tmpdir
75
+ Backtrace.apex_directory
76
+ end
77
+
78
+ module Backtrace
79
+ def self.example(styling: nil)
80
+ styling ||= false
81
+
82
+ if styling
83
+ relative_path_prefix = "\e[2m./\e[22m"
84
+ else
85
+ relative_path_prefix = "./"
86
+ end
87
+
88
+ Exception::AbsolutePaths::Example.backtrace_locations.map do |backtrace_location|
89
+ backtrace_location_text = backtrace_location.to_s
90
+
91
+ backtrace_location_text.delete_prefix!(::File.join(apex_directory, ''))
92
+
93
+ backtrace_location_text.insert(0, relative_path_prefix)
94
+
95
+ backtrace_location_text
96
+ end
97
+ end
98
+
99
+ def self.apex_directory
100
+ Path::ApexDirectory.tmpdir
101
+ end
76
102
  end
77
103
  end
78
104
  end
@@ -74,6 +74,19 @@ module TestBenchBootstrap
74
74
 
75
75
  Example = self.example
76
76
  end
77
+
78
+ module NoBacktraceLocation
79
+ def self.example
80
+ backtrace = Backtrace.example
81
+
82
+ raise SomeException, Exception.exception_message, backtrace
83
+
84
+ rescue SomeException => exception
85
+ return exception
86
+ else
87
+ abort "Unreachable"
88
+ end
89
+ end
77
90
  end
78
91
  end
79
92
  end
@@ -15,13 +15,13 @@ require 'test_bench_bootstrap/test_bench/session/controls/path/apex_directory'
15
15
  require 'test_bench_bootstrap/test_bench/session/controls/path/file'
16
16
  require 'test_bench_bootstrap/test_bench/session/controls/path/file/create'
17
17
 
18
+ require 'test_bench_bootstrap/test_bench/session/controls/backtrace'
19
+ require 'test_bench_bootstrap/test_bench/session/controls/backtrace/location'
20
+
18
21
  require 'test_bench_bootstrap/test_bench/session/controls/exception/raise'
19
22
  require 'test_bench_bootstrap/test_bench/session/controls/exception'
20
23
  require 'test_bench_bootstrap/test_bench/session/controls/exception/message'
21
24
 
22
- require 'test_bench_bootstrap/test_bench/session/controls/backtrace'
23
- require 'test_bench_bootstrap/test_bench/session/controls/backtrace/location'
24
-
25
25
  require 'test_bench_bootstrap/test_bench/session/controls/text'
26
26
  require 'test_bench_bootstrap/test_bench/session/controls/message'
27
27
  require 'test_bench_bootstrap/test_bench/session/controls/title'
@@ -36,10 +36,16 @@ module TestBenchBootstrap
36
36
  end
37
37
 
38
38
  def call(exception)
39
+ backtrace_locations = exception.backtrace_locations
40
+
41
+ if backtrace_locations.nil?
42
+ return
43
+ end
44
+
39
45
  if styling?
40
46
  omitted_text = "\e[2;3m*omitted*\e[23;22m"
41
47
  else
42
- omitted_text = "*omitted*"
48
+ omitted_text = '*omitted*'
43
49
  end
44
50
 
45
51
  backtrace = []
@@ -65,10 +71,8 @@ module TestBenchBootstrap
65
71
  end
66
72
  end
67
73
 
68
- apex_directory_prefix = ::File.join(apex_directory, '')
69
-
70
74
  backtrace.each do |backtrace_location_text|
71
- backtrace_location_text.delete_prefix!(apex_directory_prefix)
75
+ delete_apex_directory_prefix(backtrace_location_text)
72
76
  end
73
77
 
74
78
  exception.set_backtrace(backtrace)
@@ -84,7 +88,7 @@ module TestBenchBootstrap
84
88
  location ||= exception.backtrace_locations.first
85
89
 
86
90
  location = "#{location.path}:#{location.lineno}"
87
- location.delete_prefix!(apex_directory_prefix)
91
+ delete_apex_directory_prefix(location)
88
92
  location
89
93
  end
90
94
 
@@ -96,6 +100,20 @@ module TestBenchBootstrap
96
100
  end
97
101
  end
98
102
 
103
+ def delete_apex_directory_prefix(backtrace_location_text)
104
+ if styling?
105
+ relative_path_prefix = "\e[2m./\e[22m"
106
+ else
107
+ relative_path_prefix = './'
108
+ end
109
+
110
+ apex_directory_prefix = ::File.join(apex_directory, '')
111
+
112
+ if backtrace_location_text.delete_prefix!(apex_directory_prefix)
113
+ backtrace_location_text.insert(0, relative_path_prefix)
114
+ end
115
+ end
116
+
99
117
  module Defaults
100
118
  def self.omit_patterns
101
119
  env_omit_backtrace_pattern = ENV.fetch('TEST_BENCH_OMIT_BACKTRACE_PATTERN', '')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_bench-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1
4
+ version: 7.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brightworks Digital