rgot 1.3.0 → 1.5.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: e2f0075689755b0a44db0674a5069769d1ee4c2567774d7bb7422ba5b27c8960
4
- data.tar.gz: 9ddd64091ca0daeff256fcc5c305aad378a92472f4522b875512fb35915d74aa
3
+ metadata.gz: 686cd0f1c902f09e4428320e9360e35de9e3b37c70998fd425918ec52706adcb
4
+ data.tar.gz: 8d8617f7f824809d8c65e886ef340d61cfc6d8ae6e8436d096880ec082429eb3
5
5
  SHA512:
6
- metadata.gz: 2e24662ccc2f6f4644eec95f9764975b86d2ea40f49c3c8ae569f428809ca08df79e6517d2bbcf0ec7d08e610867972133a1a9ab5df245cf36896afb8ace7e63
7
- data.tar.gz: ac5c041deb124812d911d0af697a06a398ced2c79bc54f6058ec4cb2499af9dd814007f3e0c8951c50448892ba0fbc0a6846dfd879c3497601b4aebf5d00116e
6
+ metadata.gz: c5929385f2474fa9ffe0102051a107ebfc8944302afc2b76420a0cffd3601ff173120827c103a35863d305900e17fb1454c8d52ec7166073de51b749cf86cd96
7
+ data.tar.gz: 700205bc2e7d0815592904b1208d29ccbdc4adc21cf0d0cfb2e883f6b45a2d376d3615c80f327690b0c572cb6b923a503e8063743f4ef59f7f48b3e50c0595e9
@@ -14,10 +14,9 @@ jobs:
14
14
  strategy:
15
15
  matrix:
16
16
  ruby:
17
- - '2.7.7'
18
- - '3.0.5'
19
- - '3.1.3'
20
- - '3.2.0'
17
+ - '3.2'
18
+ - '3.3'
19
+ - '3.4'
21
20
 
22
21
  steps:
23
22
  - uses: actions/checkout@v3
data/Gemfile.lock CHANGED
@@ -1,62 +1,98 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rgot (1.3.0)
4
+ rgot (1.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activesupport (7.0.4)
10
- concurrent-ruby (~> 1.0, >= 1.0.2)
9
+ activesupport (8.0.1)
10
+ base64
11
+ benchmark (>= 0.3)
12
+ bigdecimal
13
+ concurrent-ruby (~> 1.0, >= 1.3.1)
14
+ connection_pool (>= 2.2.5)
15
+ drb
11
16
  i18n (>= 1.6, < 2)
17
+ logger (>= 1.4.2)
12
18
  minitest (>= 5.1)
13
- tzinfo (~> 2.0)
19
+ securerandom (>= 0.3)
20
+ tzinfo (~> 2.0, >= 2.0.5)
21
+ uri (>= 0.13.1)
14
22
  ast (2.4.2)
15
- concurrent-ruby (1.1.10)
16
- csv (3.2.6)
17
- debug (1.7.1)
18
- ffi (1.15.5)
19
- fileutils (1.7.0)
20
- i18n (1.12.0)
23
+ base64 (0.2.0)
24
+ benchmark (0.4.0)
25
+ bigdecimal (3.1.9)
26
+ concurrent-ruby (1.3.5)
27
+ connection_pool (2.5.0)
28
+ csv (3.3.2)
29
+ date (3.4.1)
30
+ debug (1.10.0)
31
+ irb (~> 1.10)
32
+ reline (>= 0.3.8)
33
+ drb (2.2.1)
34
+ ffi (1.17.1)
35
+ fileutils (1.7.3)
36
+ i18n (1.14.7)
21
37
  concurrent-ruby (~> 1.0)
22
- json (2.6.3)
23
- language_server-protocol (3.17.0.2)
24
- listen (3.7.1)
38
+ io-console (0.8.0)
39
+ irb (1.15.1)
40
+ pp (>= 0.6.0)
41
+ rdoc (>= 4.0.0)
42
+ reline (>= 0.4.2)
43
+ json (2.10.1)
44
+ language_server-protocol (3.17.0.4)
45
+ listen (3.9.0)
25
46
  rb-fsevent (~> 0.10, >= 0.10.3)
26
47
  rb-inotify (~> 0.9, >= 0.9.10)
27
- logger (1.5.3)
28
- minitest (5.17.0)
29
- parallel (1.22.1)
30
- parser (3.2.0.0)
48
+ logger (1.6.6)
49
+ minitest (5.25.4)
50
+ parser (3.3.7.1)
31
51
  ast (~> 2.4.1)
52
+ racc
53
+ pp (0.6.2)
54
+ prettyprint
55
+ prettyprint (0.2.0)
56
+ psych (5.2.3)
57
+ date
58
+ stringio
59
+ racc (1.8.1)
32
60
  rainbow (3.1.1)
33
- rake (13.0.6)
61
+ rake (13.2.1)
34
62
  rb-fsevent (0.11.2)
35
- rb-inotify (0.10.1)
63
+ rb-inotify (0.11.1)
36
64
  ffi (~> 1.0)
37
- rbs (2.8.2)
38
- securerandom (0.2.2)
39
- steep (1.3.0)
65
+ rbs (3.8.1)
66
+ logger
67
+ rdoc (6.12.0)
68
+ psych (>= 4.0.0)
69
+ reline (0.6.0)
70
+ io-console (~> 0.5)
71
+ securerandom (0.4.1)
72
+ steep (1.9.4)
40
73
  activesupport (>= 5.1)
74
+ concurrent-ruby (>= 1.1.10)
41
75
  csv (>= 3.0.9)
42
76
  fileutils (>= 1.1.0)
43
77
  json (>= 2.1.0)
44
78
  language_server-protocol (>= 3.15, < 4.0)
45
79
  listen (~> 3.0)
46
80
  logger (>= 1.3.0)
47
- parallel (>= 1.0.0)
48
81
  parser (>= 3.1)
49
82
  rainbow (>= 2.2.2, < 4.0)
50
- rbs (>= 2.8.0)
83
+ rbs (~> 3.8)
51
84
  securerandom (>= 0.1)
52
85
  strscan (>= 1.0.0)
53
86
  terminal-table (>= 2, < 4)
54
- strscan (3.0.5)
87
+ uri (>= 0.12.0)
88
+ stringio (3.1.5)
89
+ strscan (3.1.2)
55
90
  terminal-table (3.0.2)
56
91
  unicode-display_width (>= 1.1.1, < 3)
57
- tzinfo (2.0.5)
92
+ tzinfo (2.0.6)
58
93
  concurrent-ruby (~> 1.0)
59
- unicode-display_width (2.4.2)
94
+ unicode-display_width (2.6.0)
95
+ uri (1.0.3)
60
96
 
61
97
  PLATFORMS
62
98
  ruby
data/README.md CHANGED
@@ -343,6 +343,64 @@ You can set timeout sec for testing (default 0).
343
343
 
344
344
  Fail testing and print raised exception message to STDERR if timeout.
345
345
 
346
+ # Recommendation
347
+
348
+ Set up Rakefile.
349
+
350
+ ```rb
351
+ # Rakefile
352
+ require "rake/testtask"
353
+ Rake::TestTask.new do |task|
354
+ task.libs = %w[lib test]
355
+ task.test_files = FileList["lib/**/*_test.rb"]
356
+ end
357
+ ```
358
+
359
+ Set `test/test_helper.rb`.
360
+
361
+ ```rb
362
+ # test/test_helper.rb
363
+ require "rgot/cli"
364
+
365
+ unless $PROGRAM_NAME.end_with?("/rgot")
366
+ at_exit do
367
+ exit Rgot::Cli.new(["-v", *ARGV]).run
368
+ end
369
+ end
370
+ ```
371
+
372
+ Place the test file in the same directory as the implementation file.
373
+ Just like in golang.
374
+
375
+ ```console
376
+ $ ls lib
377
+ lib/foo.rb
378
+ lib/foo_test.rb
379
+ ```
380
+
381
+ Write your testing code.
382
+
383
+ ```rb
384
+ # lib/foo_test.rb
385
+ require 'test_helper'
386
+
387
+ module FooTest
388
+ def test_foo(t)
389
+ # ...
390
+ end
391
+ end
392
+ ```
393
+
394
+ OK, You will be able to both run all tests with rake and specify one file to run.
395
+
396
+ ```console
397
+ $ bundle exec rake test
398
+ ```
399
+
400
+ ```console
401
+ $ bundle exec rgot lib/foo_test.rb
402
+ ```
403
+
346
404
  # Methods
347
405
 
348
406
  ## Rgot
data/lib/rgot/cli.rb CHANGED
@@ -107,7 +107,7 @@ module Rgot
107
107
  require 'coverage'
108
108
  Coverage.start(oneshot_lines: true)
109
109
  end
110
- load testing_file
110
+ require testing_file
111
111
 
112
112
  test_module = Object.const_get(test_module_name)
113
113
  tests = []
@@ -168,11 +168,13 @@ module Rgot
168
168
  find_toplevel_name(namespace)
169
169
  end
170
170
  when :BLOCK
171
- module_node = node.children.find { |c| c.type == :MODULE }
172
- unless module_node
173
- raise "no module found"
171
+ module_nodes = node.children.select do |c|
172
+ c.type == :MODULE && find_toplevel_name(c).end_with?("Test")
174
173
  end
175
- find_toplevel_name(module_node)
174
+ raise "no module found" if module_nodes.empty?
175
+ raise "*Test module should be one for each file" if 1 < module_nodes.length
176
+
177
+ find_toplevel_name(module_nodes.first)
176
178
  else
177
179
  raise node.type.to_s
178
180
  end
data/lib/rgot/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rgot
4
- VERSION = "1.3.0"
4
+ VERSION = "1.5.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-01-04 00:00:00.000000000 Z
10
+ date: 2025-03-07 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -75,7 +74,6 @@ homepage: https://github.com/ksss/rgot
75
74
  licenses:
76
75
  - MIT
77
76
  metadata: {}
78
- post_install_message:
79
77
  rdoc_options: []
80
78
  require_paths:
81
79
  - lib
@@ -90,8 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
88
  - !ruby/object:Gem::Version
91
89
  version: '0'
92
90
  requirements: []
93
- rubygems_version: 3.4.1
94
- signing_key:
91
+ rubygems_version: 3.6.2
95
92
  specification_version: 4
96
93
  summary: Ruby + Golang Testing = Rgot
97
94
  test_files: []