yard 0.9.14 → 0.9.15
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +10 -0
- data/lib/yard/handlers/ruby/class_condition_handler.rb +11 -6
- data/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +1 -1
- data/lib/yard/version.rb +1 -1
- data/spec/cli/yard_on_yard_spec.rb +38 -0
- data/spec/examples.txt +1785 -1782
- data/spec/handlers/class_condition_handler_spec.rb +19 -0
- data/spec/parser/ruby/legacy/token_list_spec.rb +17 -15
- metadata +4 -3
@@ -65,4 +65,23 @@ RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ClassCon
|
|
65
65
|
eof
|
66
66
|
no_undoc_error "if caller.none? { |l| l =~ %r{lib/rails/generators\\.rb:(\\d+):in `lookup!'$} }; end"
|
67
67
|
end
|
68
|
+
|
69
|
+
it "only parses identifiers or namespaces from defined? expressions" do
|
70
|
+
module A
|
71
|
+
@@value = nil
|
72
|
+
def self.b(value) @@value = value end
|
73
|
+
def self.value; @@value end
|
74
|
+
end
|
75
|
+
|
76
|
+
YARD.parse_string <<-eof
|
77
|
+
if defined? A.b(42).to_i
|
78
|
+
class Foo; end
|
79
|
+
else
|
80
|
+
class Bar; end
|
81
|
+
end
|
82
|
+
eof
|
83
|
+
expect(A.value).to be_nil
|
84
|
+
expect(YARD::Registry.at('Foo')).not_to be_nil
|
85
|
+
expect(YARD::Registry.at('Bar')).not_to be_nil
|
86
|
+
end
|
68
87
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
include YARD::Parser::Ruby::Legacy
|
4
|
-
include YARD::Parser::Ruby::Legacy::RubyToken
|
5
|
-
|
6
3
|
RSpec.describe YARD::Parser::Ruby::Legacy::TokenList do
|
4
|
+
Legacy = YARD::Parser::Ruby::Legacy
|
5
|
+
TokenList = Legacy::TokenList
|
6
|
+
LT = Legacy::RubyToken
|
7
|
+
|
7
8
|
describe "#initialize / #push" do
|
8
9
|
it "accepts a tokenlist (via constructor or push)" do
|
9
10
|
expect { TokenList.new(TokenList.new) }.not_to raise_error
|
@@ -11,8 +12,9 @@ RSpec.describe YARD::Parser::Ruby::Legacy::TokenList do
|
|
11
12
|
end
|
12
13
|
|
13
14
|
it "accept a token (via constructor or push)" do
|
14
|
-
expect { TokenList.new(Token.new(0, 0)) }.not_to raise_error
|
15
|
-
expect(TokenList.new.push(Token.new(0, 0),
|
15
|
+
expect { TokenList.new(LT::Token.new(0, 0)) }.not_to raise_error
|
16
|
+
expect(TokenList.new.push(LT::Token.new(0, 0),
|
17
|
+
LT::Token.new(1, 1)).size).to eq 2
|
16
18
|
end
|
17
19
|
|
18
20
|
it "accepts a string and parse it as code (via constructor or push)" do
|
@@ -30,15 +32,15 @@ RSpec.describe YARD::Parser::Ruby::Legacy::TokenList do
|
|
30
32
|
it "does not interpolate string data" do
|
31
33
|
x = TokenList.new('x = "hello #{world}"')
|
32
34
|
expect(x.size).to eq 6
|
33
|
-
expect(x[4].class).to eq TkDSTRING
|
35
|
+
expect(x[4].class).to eq LT::TkDSTRING
|
34
36
|
expect(x.to_s).to eq 'x = "hello #{world}"' + "\n"
|
35
37
|
end
|
36
38
|
|
37
39
|
it "handles label syntax" do
|
38
40
|
x = TokenList.new('a:1,b:2')
|
39
|
-
expect(x[0].class).to eq TkLABEL
|
41
|
+
expect(x[0].class).to eq LT::TkLABEL
|
40
42
|
expect(x[0].text).to eq 'a:'
|
41
|
-
expect(x[3].class).to eq TkLABEL
|
43
|
+
expect(x[3].class).to eq LT::TkLABEL
|
42
44
|
expect(x[3].text).to eq 'b:'
|
43
45
|
end
|
44
46
|
end
|
@@ -46,13 +48,13 @@ RSpec.describe YARD::Parser::Ruby::Legacy::TokenList do
|
|
46
48
|
describe "#to_s" do
|
47
49
|
before do
|
48
50
|
@t = TokenList.new
|
49
|
-
@t << TkDEF.new(1, 1, "def")
|
50
|
-
@t << TkSPACE.new(1, 1)
|
51
|
-
@t << TkIDENTIFIER.new(1, 1, "x")
|
52
|
-
@t << TkStatementEnd.new(1, 1)
|
53
|
-
@t << TkSEMICOLON.new(1, 1) << TkSPACE.new(1, 1)
|
54
|
-
@t << TkBlockContents.new(1, 1)
|
55
|
-
@t << TkSPACE.new(1, 1) << TkEND.new(1, 1, "end")
|
51
|
+
@t << LT::TkDEF.new(1, 1, "def")
|
52
|
+
@t << LT::TkSPACE.new(1, 1)
|
53
|
+
@t << LT::TkIDENTIFIER.new(1, 1, "x")
|
54
|
+
@t << LT::TkStatementEnd.new(1, 1)
|
55
|
+
@t << LT::TkSEMICOLON.new(1, 1) << LT::TkSPACE.new(1, 1)
|
56
|
+
@t << LT::TkBlockContents.new(1, 1)
|
57
|
+
@t << LT::TkSPACE.new(1, 1) << LT::TkEND.new(1, 1, "end")
|
56
58
|
@t[0].set_text "def"
|
57
59
|
@t[1].set_text " "
|
58
60
|
@t[2].set_text "x"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loren Segal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
YARD is a documentation generation tool for the Ruby programming language.
|
@@ -290,6 +290,7 @@ files:
|
|
290
290
|
- spec/cli/markup_types_spec.rb
|
291
291
|
- spec/cli/server_spec.rb
|
292
292
|
- spec/cli/stats_spec.rb
|
293
|
+
- spec/cli/yard_on_yard_spec.rb
|
293
294
|
- spec/cli/yardoc_spec.rb
|
294
295
|
- spec/cli/yri_spec.rb
|
295
296
|
- spec/code_objects/base_spec.rb
|
@@ -638,7 +639,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
638
639
|
version: '0'
|
639
640
|
requirements: []
|
640
641
|
rubyforge_project:
|
641
|
-
rubygems_version: 2.
|
642
|
+
rubygems_version: 2.7.6
|
642
643
|
signing_key:
|
643
644
|
specification_version: 4
|
644
645
|
summary: Documentation tool for consistent and usable documentation in Ruby.
|