tryouts 3.0.0.pre → 3.0.0.pre2

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: 07be17b9ebef2d51f24a192dab9c292cf9613cf6ae32b42a98f47d34dea70045
4
- data.tar.gz: 618e98529240a7a6df56667a1fa64a9f758d76c40ace4bd815275061894c176f
3
+ metadata.gz: 54c28bd26a736f9c78bbf68a4ea1202859304a032ea101d91720cc9eabf0d3d0
4
+ data.tar.gz: 3c28d8b2baa2a4e95c7cbf062b144706a60dd57e055e0b5d98de37a3a3ef6b6c
5
5
  SHA512:
6
- metadata.gz: 8d8e493922bfd6c734466ec1f69becf5668f6b571b37e8367395e0f26aec8d19d5831e04169952b9acf2b1f04b3370fe33a163d50d776d42dcdfecc3aea1a0c6
7
- data.tar.gz: 4aaac8820547f393a95dfb82f621aedef8142264298ef437beffe853b83a2fb61ee2687d5bf1cf0c74f852bc7192b49b963d133fcda5354a0250dfe309ec435c
6
+ metadata.gz: 33d673cbe361ee0d20a3e23d7a27ba65abf7bca0700df5c4fd66e4f9b9705494cc9c5de0dcfd59e6e015bfad87369f8a32cff0225efaac99a877588999469779
7
+ data.tar.gz: e280b2f0bdba2fe976c120061af0fe2d9711c8388db0554f74bed0d66641d2e4771138467d7941d0989802a4e58706283b731463098494705150dc6471f27740
data/README.md CHANGED
@@ -48,15 +48,15 @@ bundle install
48
48
  try
49
49
 
50
50
  # Run specific test file
51
- try try/step1_try.rb
51
+ try try/proof1_try.rb
52
52
 
53
53
  # Framework integration
54
- try --rspec try/step1_try.rb # Run with RSpec
55
- try --minitest try/step1_try.rb # Run with Minitest
54
+ try --rspec try/proof1_try.rb # Run with RSpec
55
+ try --minitest try/proof1_try.rb # Run with Minitest
56
56
 
57
57
  # Code generation only
58
- try --generate-rspec try/step1_try.rb
59
- try --generate-minitest try/step1_try.rb
58
+ try --generate-rspec try/proof1_try.rb
59
+ try --generate-minitest try/proof1_try.rb
60
60
 
61
61
  # Output options
62
62
  try -v # verbose (includes source code and return values)
data/exe/try CHANGED
@@ -1,5 +1,37 @@
1
1
  #!/usr/bin/env /Users/d/.rbenv/shims/ruby
2
2
 
3
+ # Coverage tracking (must be first)
4
+ if ENV['COVERAGE'] || ENV['SIMPLECOV']
5
+ require 'simplecov'
6
+ # Reset any existing coverage data to prevent line count mismatches
7
+ Coverage.result(stop: false, clear: true) if defined?(Coverage)
8
+ SimpleCov.start do
9
+ track_files 'lib/**/*.rb'
10
+ add_filter '/try/'
11
+ add_filter '/test/'
12
+ add_filter '/test_'
13
+ add_filter '/spec/'
14
+ add_filter '/examples/'
15
+ add_filter '/docs/'
16
+
17
+ add_group 'Core', 'lib/tryouts.rb'
18
+ add_group 'CLI', 'lib/tryouts/cli'
19
+ add_group 'Formatters', 'lib/tryouts/cli/formatters'
20
+ add_group 'Parsers', 'lib/tryouts/prism_parser.rb'
21
+ add_group 'Data Structures', ['lib/tryouts/testcase.rb', 'lib/tryouts/testbatch.rb']
22
+ add_group 'Translators', 'lib/tryouts/translators'
23
+ add_group 'Execution', ['lib/tryouts/test_executor.rb', 'lib/tryouts/test_runner.rb', 'lib/tryouts/file_processor.rb']
24
+
25
+ coverage_dir 'coverage'
26
+
27
+ # Coverage thresholds disabled to prevent CI failures
28
+ # minimum_coverage 80
29
+ # minimum_coverage_by_file 70
30
+ end
31
+
32
+ SimpleCov.command_name 'Tryouts CLI'
33
+ end
34
+
3
35
  require_relative '../lib/tryouts'
4
36
 
5
37
  # Add development library paths
@@ -65,7 +65,15 @@ class Tryouts
65
65
  detail << "#{error_count} errors"
66
66
  end
67
67
 
68
- time_str = elapsed_time ? " (#{elapsed_time.round(2)}s)" : ''
68
+ time_str = if elapsed_time
69
+ if elapsed_time < 2
70
+ " (#{(elapsed_time * 1000).to_i}ms)"
71
+ else
72
+ " (#{elapsed_time.round(2)}s)"
73
+ end
74
+ else
75
+ ''
76
+ end
69
77
  puts " #{status} #{detail.join(', ')}#{time_str}"
70
78
  end
71
79
 
@@ -169,7 +177,13 @@ class Tryouts
169
177
  result = Console.color(:green, "#{total_tests} tests passed")
170
178
  end
171
179
 
172
- puts "Total: #{result} (#{elapsed_time.round(2)}s)"
180
+ time_str = if elapsed_time < 2
181
+ "#{(elapsed_time * 1000).to_i}ms"
182
+ else
183
+ "#{elapsed_time.round(2)}s"
184
+ end
185
+
186
+ puts "Total: #{result} (#{time_str})"
173
187
  puts "Files: #{successful_files} of #{total_files} successful"
174
188
  end
175
189
 
@@ -214,5 +228,19 @@ class Tryouts
214
228
  end
215
229
  end
216
230
  end
231
+
232
+ # Compact formatter that only shows failures and errors
233
+ class CompactFailsFormatter < CompactFormatter
234
+ def initialize(options = {})
235
+ super(options.merge(show_passed: false))
236
+ end
237
+
238
+ def test_result(test_case, result_status, actual_results = [], elapsed_time = nil)
239
+ # Only show failed/error tests
240
+ return if result_status == :passed
241
+
242
+ super
243
+ end
244
+ end
217
245
  end
218
246
  end
@@ -21,9 +21,17 @@ class Tryouts
21
21
  VerboseFormatter.new(options)
22
22
  end
23
23
  when :compact
24
- CompactFormatter.new(options)
24
+ if options[:fails_only]
25
+ CompactFailsFormatter.new(options)
26
+ else
27
+ CompactFormatter.new(options)
28
+ end
25
29
  when :quiet
26
- QuietFormatter.new(options)
30
+ if options[:fails_only]
31
+ QuietFailsFormatter.new(options)
32
+ else
33
+ QuietFormatter.new(options)
34
+ end
27
35
  else
28
36
  VerboseFormatter.new(options) # Default to verbose
29
37
  end
@@ -26,7 +26,7 @@ class Tryouts
26
26
  # Silent in quiet mode
27
27
  end
28
28
 
29
- def file_execution_start(file_path, test_count, context_mode)
29
+ def file_execution_start(file_path, _test_count, _context_mode)
30
30
  @current_file = file_path
31
31
  end
32
32
 
@@ -98,15 +98,21 @@ class Tryouts
98
98
 
99
99
  puts
100
100
 
101
+ time_str = if elapsed_time < 2
102
+ "#{(elapsed_time * 1000).to_i}ms"
103
+ else
104
+ "#{elapsed_time.round(2)}s"
105
+ end
106
+
101
107
  issues_count = failed_count + error_count
102
108
  if issues_count > 0
103
109
  passed = total_tests - issues_count
104
110
  details = []
105
111
  details << "#{failed_count} failed" if failed_count > 0
106
112
  details << "#{error_count} errors" if error_count > 0
107
- puts Console.color(:red, "Total: #{details.join(', ')}, #{passed} passed (#{elapsed_time.round(2)}s)")
113
+ puts Console.color(:red, "Total: #{details.join(', ')}, #{passed} passed (#{time_str})")
108
114
  else
109
- puts Console.color(:green, "Total: #{total_tests} passed (#{elapsed_time.round(2)}s)")
115
+ puts Console.color(:green, "Total: #{total_tests} passed (#{time_str})")
110
116
  end
111
117
 
112
118
  if total_files > 1
@@ -139,5 +145,15 @@ class Tryouts
139
145
  # Silent in quiet mode
140
146
  end
141
147
  end
148
+
149
+ # Quiet formatter that only shows dots for failures and errors
150
+ class QuietFailsFormatter < QuietFormatter
151
+ def test_result(test_case, result_status, actual_results = [], elapsed_time = nil)
152
+ # Only show non-pass dots in fails mode
153
+ return if result_status == :passed
154
+
155
+ super
156
+ end
157
+ end
142
158
  end
143
159
  end
@@ -10,12 +10,14 @@ class Tryouts
10
10
  @line_width = options.fetch(:line_width, 70)
11
11
  @show_passed = options.fetch(:show_passed, true)
12
12
  @show_debug = options.fetch(:debug, false)
13
- @show_trace = options.fetch(:trace, true)
13
+ @show_trace = options.fetch(:trace, false)
14
14
  @current_indent = 0
15
15
  end
16
16
 
17
17
  # Phase-level output
18
18
  def phase_header(message, _file_count = nil, level = 0)
19
+ return if level.equal?(1)
20
+
19
21
  separators = [
20
22
  { char: '=', width: @line_width }, # Major phases
21
23
  { char: '-', width: @line_width - 10 }, # Sub-phases
@@ -43,20 +45,11 @@ class Tryouts
43
45
 
44
46
  # File-level operations
45
47
  def file_start(file_path, _context_info = {})
46
- # framework = context_info[:framework] || :direct
47
- # context = context_info[:context] || :fresh
48
-
49
- # with_indent(1) do
50
- # puts "Framework: #{framework}"
51
- # puts "Context: #{context}"
52
- # end
53
-
54
48
  puts file_header_visual(file_path)
55
49
  end
56
50
 
57
- def file_parsed(file_path, test_count, setup_present: false, teardown_present: false)
58
- pretty_path = Console.pretty_path(file_path)
59
- message = "Parsed #{test_count} test cases from #{pretty_path}"
51
+ def file_parsed(_file_path, _test_count, setup_present: false, teardown_present: false)
52
+ message = ''
60
53
 
61
54
  extras = []
62
55
  extras << 'setup' if setup_present
@@ -85,11 +78,15 @@ class Tryouts
85
78
  end
86
79
 
87
80
  puts indent_text(status, 2)
81
+ return unless elapsed_time
88
82
 
89
- if elapsed_time
90
- time_msg = "Completed in #{elapsed_time.round(3)}s"
91
- puts indent_text(Console.color(:dim, time_msg), 2)
92
- end
83
+ time_msg =
84
+ if elapsed_time < 2.0
85
+ "Completed in #{(elapsed_time * 1000).round}ms"
86
+ else
87
+ "Completed in #{elapsed_time.round(3)}s"
88
+ end
89
+ puts indent_text(Console.color(:dim, time_msg), 2)
93
90
  end
94
91
 
95
92
  # Test-level operations
@@ -130,7 +127,7 @@ class Tryouts
130
127
  end
131
128
  end
132
129
 
133
- def test_output(test_case, output_text)
130
+ def test_output(_test_case, output_text)
134
131
  return if output_text.nil? || output_text.strip.empty?
135
132
 
136
133
  puts indent_text('Test Output:', 3)
@@ -193,14 +190,21 @@ class Tryouts
193
190
  puts 'Grand Total:'
194
191
 
195
192
  issues_count = failed_count + error_count
193
+ time_str =
194
+ if elapsed_time < 2.0
195
+ " (#{(elapsed_time * 1000).round}ms)"
196
+ else
197
+ " (#{elapsed_time.round(2)}s)"
198
+ end
199
+
196
200
  if issues_count > 0
197
201
  passed = total_tests - issues_count
198
202
  details = []
199
203
  details << "#{failed_count} failed" if failed_count > 0
200
204
  details << "#{error_count} errors" if error_count > 0
201
- puts "#{details.join(', ')}, #{passed} passed (#{elapsed_time.round(2)}s)"
205
+ puts "#{details.join(', ')}, #{passed} passed#{time_str}"
202
206
  else
203
- puts "#{total_tests} tests passed (#{elapsed_time.round(2)}s)"
207
+ puts "#{total_tests} tests passed#{time_str}"
204
208
  end
205
209
 
206
210
  puts "Files processed: #{successful_files} of #{total_files} successful"
@@ -121,15 +121,15 @@ class Tryouts
121
121
  style(ATTRIBUTES[:default], COLOURS[:default], BGCOLOURS[:default])
122
122
  end
123
123
 
124
- # Converts an absolute file path to a path relative to the application's
125
- # base directory. This simplifies logging and error reporting by showing
124
+ # Converts an absolute file path to a path relative to the current working
125
+ # directory. This simplifies logging and error reporting by showing
126
126
  # only the relevant parts of file paths instead of lengthy absolute paths.
127
127
  #
128
128
  def pretty_path(file)
129
129
  return nil if file.nil?
130
130
 
131
131
  file = File.expand_path(file) # be absolutely sure
132
- basepath = File.expand_path('..', TRYOUTS_LIB_HOME)
132
+ basepath = Dir.pwd
133
133
  Pathname.new(file).relative_path_from(basepath).to_s
134
134
  end
135
135
  end
@@ -56,7 +56,7 @@ class Tryouts
56
56
  @global_tally[:total_errors] += file_error_count
57
57
  @global_tally[:successful_files] += 1 if success
58
58
 
59
- duration = Time.now - @file_start
59
+ duration = Time.now.to_f - @file_start.to_f
60
60
  @output_manager.file_success(@file, batch.size, file_failed_count, file_error_count, duration)
61
61
 
62
62
  # Combine failures and errors to determine the exit code.
@@ -1,5 +1,5 @@
1
1
  # lib/tryouts/version.rb
2
2
 
3
3
  class Tryouts
4
- VERSION = '3.0.0.pre'
4
+ VERSION = '3.0.0.pre2'
5
5
  end
data/lib/tryouts.rb CHANGED
@@ -1,10 +1,6 @@
1
1
  # lib/tryouts.rb
2
2
 
3
- # Coverage tracking
4
- if ENV['COVERAGE'] || ENV['SIMPLECOV']
5
- require 'simplecov'
6
- SimpleCov.start
7
- end
3
+
8
4
 
9
5
  require 'stringio'
10
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tryouts
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre
4
+ version: 3.0.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum