test_bench-session 3.0.0.0.pre.6 → 3.0.1.0

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: e65cd9a3f0b2d095a7434c2cb0943e152e08e4388e684f1e0861980618aefa44
4
- data.tar.gz: 2aff239b26fed7ab1bd65a9e122d5d20113df72f0dbdafd0d589cb00d5582b9b
3
+ metadata.gz: 14f5e3eddb8da4c798212f87882e14cd22d349bbd4b7fbd2fb293ea48c0e9822
4
+ data.tar.gz: ca42f8262fc6246339cd8b7be923dd3773749370c58288b41438e3311175d0f0
5
5
  SHA512:
6
- metadata.gz: 81d0604043f76f0a683e2681247523516957a2f33ed8269854c93b5d881a97df83fa9a48182ed0569d427bbb3a58db1d80eb579e6b8a965f371f7318e84d384c
7
- data.tar.gz: e6b9b69780523032373507ca96b140dde6df79cb1b893eeb907a89934252334d15909ef24c7f0d6e592610320f1990d5d95161c4463cab94a706402d818fd331
6
+ metadata.gz: 203acc24e3ba210f9664e08ab80b0c64829ed9823edc8473d8b72367f2140957d44213683471c539e87de065c015ce3c9527bbf966c853a8b87a1a20cd4c2733
7
+ data.tar.gz: 9e3e3e73efc83697cb654eff19ffb24754442860bd7f261c05ac981ae78c9fc68f806c6a9b3a00e81d62de0c52690742e248a89825892542a88d1554abd8ccc3
@@ -30,10 +30,12 @@ module TestBench
30
30
 
31
31
  module Styling
32
32
  def self.example
33
+ backtrace = AbsolutePaths::Local::Backtrace.example(styling: true)
34
+
33
35
  [
34
- Exception::Example.backtrace.first,
36
+ backtrace.first,
35
37
  "\e[2;3m*omitted*\e[23;22m",
36
- Exception::Example.backtrace.last
38
+ backtrace.last
37
39
  ]
38
40
  end
39
41
  end
@@ -65,13 +67,37 @@ module TestBench
65
67
  end
66
68
 
67
69
  def self.backtrace
68
- Exception::AbsolutePaths::Example.backtrace_locations.map do |backtrace_location|
69
- backtrace_location.to_s.delete_prefix(::File.join(apex_directory, ''))
70
- end
70
+ Backtrace.example
71
71
  end
72
72
 
73
73
  def self.apex_directory
74
- Path::ApexDirectory.tmpdir
74
+ Backtrace.apex_directory
75
+ end
76
+
77
+ module Backtrace
78
+ def self.example(styling: nil)
79
+ styling ||= false
80
+
81
+ if styling
82
+ relative_path_prefix = "\e[2m./\e[22m"
83
+ else
84
+ relative_path_prefix = "./"
85
+ end
86
+
87
+ Exception::AbsolutePaths::Example.backtrace_locations.map do |backtrace_location|
88
+ backtrace_location_text = backtrace_location.to_s
89
+
90
+ backtrace_location_text.delete_prefix!(::File.join(apex_directory, ''))
91
+
92
+ backtrace_location_text.insert(0, relative_path_prefix)
93
+
94
+ backtrace_location_text
95
+ end
96
+ end
97
+
98
+ def self.apex_directory
99
+ Path::ApexDirectory.tmpdir
100
+ end
75
101
  end
76
102
  end
77
103
  end
@@ -38,7 +38,7 @@ module TestBench
38
38
  if styling?
39
39
  omitted_text = "\e[2;3m*omitted*\e[23;22m"
40
40
  else
41
- omitted_text = "*omitted*"
41
+ omitted_text = '*omitted*'
42
42
  end
43
43
 
44
44
  backtrace = []
@@ -64,10 +64,8 @@ module TestBench
64
64
  end
65
65
  end
66
66
 
67
- apex_directory_prefix = ::File.join(apex_directory, '')
68
-
69
67
  backtrace.each do |backtrace_location_text|
70
- backtrace_location_text.delete_prefix!(apex_directory_prefix)
68
+ delete_apex_directory_prefix(backtrace_location_text)
71
69
  end
72
70
 
73
71
  exception.set_backtrace(backtrace)
@@ -83,7 +81,7 @@ module TestBench
83
81
  location ||= exception.backtrace_locations.first
84
82
 
85
83
  location = "#{location.path}:#{location.lineno}"
86
- location.delete_prefix!(apex_directory_prefix)
84
+ delete_apex_directory_prefix(location)
87
85
  location
88
86
  end
89
87
 
@@ -95,6 +93,20 @@ module TestBench
95
93
  end
96
94
  end
97
95
 
96
+ def delete_apex_directory_prefix(backtrace_location_text)
97
+ if styling?
98
+ relative_path_prefix = "\e[2m./\e[22m"
99
+ else
100
+ relative_path_prefix = './'
101
+ end
102
+
103
+ apex_directory_prefix = ::File.join(apex_directory, '')
104
+
105
+ if backtrace_location_text.delete_prefix!(apex_directory_prefix)
106
+ backtrace_location_text.insert(0, relative_path_prefix)
107
+ end
108
+ end
109
+
98
110
  module Defaults
99
111
  def self.omit_patterns
100
112
  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-session
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.0.pre.6
4
+ version: 3.0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brightworks Digital