tldr 0.10.0 → 0.10.1

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: 99a624f1917fbfcd057cf445c09e01c41dbbe9666d9e30219dae66ca63d2ae96
4
- data.tar.gz: 19aa8844384432251b27c3303d714535f688b48ee1b0813eb3adaf22fdc8c094
3
+ metadata.gz: 29759fb49b03f109abea0bc89b863a8094b965784e6827772dae2e148b6b38fd
4
+ data.tar.gz: f511164ea7cfb2602fe242dbd0cb3cfa36fee656d89a38cede3eb09ae73ffaef
5
5
  SHA512:
6
- metadata.gz: 92077e5052669276a18135bcb14fc04d70ba84d7b6af4d6c74afb234fb4fbbe21ff419ab3760ed0fc8a46feca6b7c15a7dd5ba11218168a41fcd3fc625f048c0
7
- data.tar.gz: fc6e72b814928a0cf7b76a2586f495094932e0d0115361540bba8c172e1f2f09e647e6e1cc318d3646849325dc834ac55fc6e91a337091fa34ec2ffaacf937b4
6
+ metadata.gz: 4a2760b9496cf063b295c08661004e24def945d219b45869ac731ab856b6370138d3bb53549ea7612110bf7ed8f9f565400413ef7b8c1084b2dce96d916aea86
7
+ data.tar.gz: 47d2fa8f8c3a32a4ee6eb730d097960d404f9eef5f406b07bf599049e391614f6b095be5222c181bb2d35cbf527f8bae86829edf8758cddccb49c0e4dc438967
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.10.1]
2
+
3
+ * Fix 3.4 / Prism [#17](https://github.com/tendersearls/tldr/pull/17)
4
+
1
5
  ## [0.10.0]
2
6
 
3
7
  * Add an option to print the stack traces of interrupted tests [#13](https://github.com/tendersearls/tldr/pull/13) by [@henrahmagix](https://github.com/henrahmagix)
@@ -0,0 +1,32 @@
1
+ class TLDR
2
+ module RubyUtil
3
+ def self.version
4
+ @version ||= Gem::Version.new(RUBY_VERSION)
5
+ end
6
+
7
+ def self.parsing_with_prism?
8
+ @parsing_with_prism ||= RubyVM::InstructionSequence.compile("").to_a[4][:parser] == :prism
9
+ end
10
+
11
+ def self.find_prism_def_node_for(method)
12
+ require "prism"
13
+
14
+ iseq = RubyVM::InstructionSequence.of(method).to_a
15
+ method_metadata = iseq[4]
16
+ method_name = iseq[5]
17
+
18
+ file_path, line_number = method.source_location
19
+ parse_prism_ast(file_path).breadth_first_search { |node|
20
+ node.type == :def_node &&
21
+ line_number == node.start_line &&
22
+ method_name == node.name.to_s &&
23
+ method_metadata[:code_location] == [node.start_line, node.start_column, node.end_line, node.end_column]
24
+ }
25
+ end
26
+
27
+ def self.parse_prism_ast(file_path)
28
+ @prism_ast = Thread.current[:prism_parse_results] ||= {}
29
+ @prism_ast[file_path] ||= Prism.parse(File.read(file_path)).value
30
+ end
31
+ end
32
+ end
@@ -48,7 +48,7 @@ class TLDR
48
48
  revert_working_directory_change_because_itll_ruin_everything!(original_base_path)
49
49
  end
50
50
 
51
- super(**args)
51
+ super
52
52
  end
53
53
 
54
54
  # These are for internal tracking and resolved at initialization-time
@@ -8,14 +8,6 @@ class TLDR
8
8
  @location = Location.new(file, line)
9
9
  end
10
10
 
11
- # Memoizing at call time, because re-parsing isn't free and isn't usually necessary
12
- def end_line
13
- @end_line ||= begin
14
- test_method = SorbetCompatibility.unwrap_method(test_class.instance_method(method_name))
15
- RubyVM::AbstractSyntaxTree.of(test_method).last_lineno
16
- end
17
- end
18
-
19
11
  # Test exact match starting line condition first to save us a potential re-parsing to look up end_line
20
12
  def covers_line? l
21
13
  line == l || (l >= line && l <= end_line)
@@ -24,5 +16,19 @@ class TLDR
24
16
  def group?
25
17
  false
26
18
  end
19
+
20
+ private
21
+
22
+ # Memoizing at call time, because re-parsing isn't free and isn't usually necessary
23
+ def end_line
24
+ @end_line ||= begin
25
+ test_method = SorbetCompatibility.unwrap_method(test_class.instance_method(method_name))
26
+ if RubyUtil.parsing_with_prism?
27
+ RubyUtil.find_prism_def_node_for(test_method)&.end_line || -1
28
+ else
29
+ RubyVM::AbstractSyntaxTree.of(test_method).last_lineno
30
+ end
31
+ end
32
+ end
27
33
  end
28
34
  end
data/lib/tldr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class TLDR
2
- VERSION = "0.10.0"
2
+ VERSION = "0.10.1"
3
3
  end
data/lib/tldr.rb CHANGED
@@ -11,6 +11,7 @@ require_relative "tldr/parallel_controls"
11
11
  require_relative "tldr/path_util"
12
12
  require_relative "tldr/planner"
13
13
  require_relative "tldr/reporters"
14
+ require_relative "tldr/ruby_util"
14
15
  require_relative "tldr/runner"
15
16
  require_relative "tldr/skippable"
16
17
  require_relative "tldr/sorbet_compatibility"
data/script/upgrade ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ bundle update
6
+
7
+ cd example/a
8
+ bundle update
9
+ cd ../..
10
+
11
+ cd example/b
12
+ bundle update
13
+ cd ../..
14
+
15
+ cd example/c
16
+ bundle update
17
+ cd ../..
18
+
19
+ cd example/d
20
+ bundle update
21
+ cd ../..
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tldr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  - Aaron Patterson
9
- autorequire:
10
9
  bindir: exe
11
10
  cert_chain: []
12
- date: 2024-01-11 00:00:00.000000000 Z
11
+ date: 2025-03-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: super_diff
@@ -39,7 +38,6 @@ dependencies:
39
38
  - - "~>"
40
39
  - !ruby/object:Gem::Version
41
40
  version: '1.2'
42
- description:
43
41
  email:
44
42
  - searls@gmail.com
45
43
  - tenderlove@ruby-lang.org
@@ -73,6 +71,7 @@ files:
73
71
  - lib/tldr/reporters/base.rb
74
72
  - lib/tldr/reporters/default.rb
75
73
  - lib/tldr/reporters/icon_provider.rb
74
+ - lib/tldr/ruby_util.rb
76
75
  - lib/tldr/runner.rb
77
76
  - lib/tldr/skippable.rb
78
77
  - lib/tldr/sorbet_compatibility.rb
@@ -89,6 +88,7 @@ files:
89
88
  - lib/tldr/watcher.rb
90
89
  - script/setup
91
90
  - script/test
91
+ - script/upgrade
92
92
  homepage: https://github.com/tendersearls/tldr
93
93
  licenses:
94
94
  - MIT
@@ -96,7 +96,6 @@ metadata:
96
96
  homepage_uri: https://github.com/tendersearls/tldr
97
97
  source_code_uri: https://github.com/tendersearls/tldr
98
98
  changelog_uri: https://github.com/tendersearls/tldr/blob/main/CHANGELOG.md
99
- post_install_message:
100
99
  rdoc_options: []
101
100
  require_paths:
102
101
  - lib
@@ -111,8 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
110
  - !ruby/object:Gem::Version
112
111
  version: '0'
113
112
  requirements: []
114
- rubygems_version: 3.4.21
115
- signing_key:
113
+ rubygems_version: 3.6.2
116
114
  specification_version: 4
117
115
  summary: TLDR will run your tests, but only for 1.8 seconds.
118
116
  test_files: []