inch 0.4.10 → 0.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -11
- data/Gemfile +2 -5
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/bin/inch +3 -3
- data/config/defaults.rb +0 -7
- data/inch.gemspec +7 -7
- data/lib/inch.rb +9 -9
- data/lib/inch/api.rb +10 -10
- data/lib/inch/api/compare.rb +2 -2
- data/lib/inch/api/compare/code_objects.rb +3 -2
- data/lib/inch/api/compare/codebases.rb +1 -1
- data/lib/inch/api/diff.rb +10 -7
- data/lib/inch/api/filter.rb +1 -1
- data/lib/inch/api/get.rb +1 -1
- data/lib/inch/api/options/base.rb +4 -4
- data/lib/inch/api/options/filter.rb +4 -0
- data/lib/inch/api/options/suggest.rb +5 -1
- data/lib/inch/api/stats.rb +1 -0
- data/lib/inch/api/suggest.rb +10 -9
- data/lib/inch/cli.rb +6 -6
- data/lib/inch/cli/arguments.rb +2 -2
- data/lib/inch/cli/command.rb +15 -15
- data/lib/inch/cli/command/base.rb +4 -4
- data/lib/inch/cli/command/console.rb +5 -5
- data/lib/inch/cli/command/diff.rb +8 -7
- data/lib/inch/cli/command/inspect.rb +4 -5
- data/lib/inch/cli/command/list.rb +4 -4
- data/lib/inch/cli/command/options/base.rb +8 -8
- data/lib/inch/cli/command/options/base_list.rb +5 -9
- data/lib/inch/cli/command/options/console.rb +3 -4
- data/lib/inch/cli/command/options/diff.rb +6 -8
- data/lib/inch/cli/command/options/inspect.rb +2 -2
- data/lib/inch/cli/command/options/list.rb +2 -3
- data/lib/inch/cli/command/options/show.rb +2 -2
- data/lib/inch/cli/command/options/stats.rb +1 -2
- data/lib/inch/cli/command/options/suggest.rb +3 -6
- data/lib/inch/cli/command/output/base.rb +6 -4
- data/lib/inch/cli/command/output/console.rb +5 -4
- data/lib/inch/cli/command/output/diff.rb +6 -6
- data/lib/inch/cli/command/output/inspect.rb +8 -6
- data/lib/inch/cli/command/output/list.rb +1 -0
- data/lib/inch/cli/command/output/show.rb +5 -4
- data/lib/inch/cli/command/output/stats.rb +21 -21
- data/lib/inch/cli/command/output/suggest.rb +27 -30
- data/lib/inch/cli/command/show.rb +4 -4
- data/lib/inch/cli/command/stats.rb +4 -4
- data/lib/inch/cli/command/suggest.rb +6 -6
- data/lib/inch/cli/command_parser.rb +5 -6
- data/lib/inch/cli/sparkline_helper.rb +6 -6
- data/lib/inch/cli/trace_helper.rb +1 -1
- data/lib/inch/cli/yardopts_helper.rb +3 -4
- data/lib/inch/code_object.rb +3 -3
- data/lib/inch/code_object/converter.rb +8 -6
- data/lib/inch/code_object/provider.rb +1 -1
- data/lib/inch/code_object/provider/yard.rb +12 -10
- data/lib/inch/code_object/provider/yard/docstring.rb +19 -51
- data/lib/inch/code_object/provider/yard/nodoc_helper.rb +4 -4
- data/lib/inch/code_object/provider/yard/object.rb +10 -12
- data/lib/inch/code_object/provider/yard/object/base.rb +27 -48
- data/lib/inch/code_object/provider/yard/object/method_object.rb +10 -47
- data/lib/inch/code_object/provider/yard/object/method_parameter_object.rb +6 -10
- data/lib/inch/code_object/provider/yard/object/method_signature.rb +8 -12
- data/lib/inch/code_object/provider/yard/object/namespace_object.rb +4 -1
- data/lib/inch/code_object/provider/yard/parser.rb +3 -3
- data/lib/inch/code_object/proxy.rb +9 -10
- data/lib/inch/code_object/proxy/base.rb +10 -12
- data/lib/inch/code_object/proxy/method_object.rb +2 -3
- data/lib/inch/code_object/proxy/method_parameter_object.rb +3 -5
- data/lib/inch/codebase.rb +5 -4
- data/lib/inch/codebase/objects_filter.rb +4 -2
- data/lib/inch/codebase/serializer.rb +3 -3
- data/lib/inch/config.rb +2 -2
- data/lib/inch/config/base.rb +1 -0
- data/lib/inch/config/codebase.rb +4 -4
- data/lib/inch/core_ext.rb +1 -1
- data/lib/inch/core_ext/string.rb +1 -1
- data/lib/inch/evaluation.rb +15 -16
- data/lib/inch/evaluation/file.rb +1 -1
- data/lib/inch/evaluation/grade_list.rb +2 -2
- data/lib/inch/evaluation/object_schema.rb +1 -1
- data/lib/inch/evaluation/proxy.rb +7 -8
- data/lib/inch/evaluation/proxy/base.rb +10 -13
- data/lib/inch/evaluation/proxy/constant_object.rb +1 -1
- data/lib/inch/evaluation/proxy/method_object.rb +5 -12
- data/lib/inch/evaluation/proxy/module_object.rb +1 -1
- data/lib/inch/evaluation/proxy/namespace_object.rb +1 -1
- data/lib/inch/evaluation/role/base.rb +1 -1
- data/lib/inch/evaluation/role/method.rb +2 -2
- data/lib/inch/evaluation/role/method_parameter.rb +1 -2
- data/lib/inch/evaluation/role/object.rb +2 -2
- data/lib/inch/rake.rb +2 -2
- data/lib/inch/rake/suggest.rb +2 -3
- data/lib/inch/utils/shell_helper.rb +1 -1
- data/lib/inch/utils/ui.rb +5 -5
- data/lib/inch/utils/weighted_list.rb +3 -2
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/simple/lib/broken.rb +7 -35
- data/test/fixtures/simple/lib/foo.rb +1 -22
- data/test/integration/api/compare/codebases.rb +1 -1
- data/test/integration/cli/command/console_test.rb +5 -5
- data/test/integration/cli/command/inspect_test.rb +5 -4
- data/test/integration/cli/command/list_test.rb +4 -3
- data/test/integration/cli/command/show_test.rb +4 -4
- data/test/integration/cli/command/stats_test.rb +2 -2
- data/test/integration/cli/command/suggest_test.rb +10 -10
- data/test/integration/stats_options_test.rb +3 -3
- data/test/integration/visibility_options_test.rb +13 -13
- data/test/shared/base_list.rb +3 -4
- data/test/test_helper.rb +6 -16
- data/test/unit/api/filter_test.rb +7 -7
- data/test/unit/api/get_test.rb +1 -1
- data/test/unit/api/list_test.rb +1 -1
- data/test/unit/api/options/base_test.rb +3 -3
- data/test/unit/api/stats_test.rb +1 -1
- data/test/unit/api/suggest_test.rb +3 -3
- data/test/unit/cli/arguments_test.rb +1 -1
- data/test/unit/cli/command/base_test.rb +1 -1
- data/test/unit/cli/command/options/base_list_test.rb +2 -2
- data/test/unit/cli/command/options/base_object_test.rb +1 -1
- data/test/unit/cli/command/options/base_test.rb +1 -1
- data/test/unit/cli/command_parser_test.rb +2 -2
- data/test/unit/cli/trace_helper_test.rb +1 -1
- data/test/unit/cli/yardopts_helper_test.rb +3 -4
- data/test/unit/code_object/converter_test.rb +1 -1
- data/test/unit/code_object/provider/yard/docstring_test.rb +28 -106
- data/test/unit/code_object/provider/yard/nodoc_helper_test.rb +5 -6
- data/test/unit/code_object/provider/yard/object/method_object_test.rb +10 -20
- data/test/unit/code_object/provider/yard_test.rb +4 -4
- data/test/unit/code_object/provider_test.rb +1 -1
- data/test/unit/code_object/proxy/method_object_test.rb +262 -382
- data/test/unit/code_object/proxy_test.rb +1 -1
- data/test/unit/codebase/objects_test.rb +2 -2
- data/test/unit/codebase/proxy_test.rb +1 -1
- data/test/unit/config/codebase_test.rb +1 -1
- data/test/unit/evaluation/role/base_test.rb +2 -2
- data/test/unit/utils/ui_test.rb +4 -4
- data/test/unit/utils/weighted_list_test.rb +4 -7
- metadata +4 -14
- data/.rubocop.yml +0 -15
- data/.rubocop_todo.yml +0 -94
- data/lib/inch/code_object/provider/yard/object/class_variable_object.rb +0 -12
- data/lib/inch/code_object/proxy/class_variable_object.rb +0 -8
- data/lib/inch/evaluation/proxy/class_variable_object.rb +0 -19
- data/lib/inch/evaluation/role/class_variable.rb +0 -55
- data/test/fixtures/simple/lib/broken_ruby_2_0_features.rb +0 -7
- data/test/fixtures/simple/lib/directives.rb +0 -8
data/test/unit/api/get_test.rb
CHANGED
data/test/unit/api/list_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
|
2
2
|
|
3
3
|
describe ::Inch::API::Options::Base do
|
4
4
|
class APIOptionsTest < ::Inch::API::Options::Base
|
@@ -8,7 +8,7 @@ describe ::Inch::API::Options::Base do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should work with a Hash or Struct" do
|
11
|
-
@options_hash = {
|
11
|
+
@options_hash = {:foo => "foo", :baz => 42}
|
12
12
|
@options_struct = OpenStruct.new(@options_hash)
|
13
13
|
|
14
14
|
@options1 = APIOptionsTest.new @options_hash
|
@@ -21,7 +21,7 @@ describe ::Inch::API::Options::Base do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should return default values" do
|
24
|
-
@options_hash = {
|
24
|
+
@options_hash = {:baz => 42}
|
25
25
|
@options = APIOptionsTest.new @options_hash
|
26
26
|
|
27
27
|
assert_equal :bar, @options.foo
|
data/test/unit/api/stats_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
2
2
|
|
3
3
|
describe ::Inch::API::Suggest do
|
4
4
|
before do
|
@@ -13,10 +13,10 @@ describe ::Inch::API::Suggest do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should work with option: object_count" do
|
16
|
-
@options = {
|
16
|
+
@options = {:object_count => 10}
|
17
17
|
@context = ::Inch::API::Suggest.new @codebase, @options
|
18
18
|
|
19
|
-
@options2 = {
|
19
|
+
@options2 = {:object_count => 20}
|
20
20
|
@context2 = ::Inch::API::Suggest.new @codebase, @options2
|
21
21
|
|
22
22
|
assert_equal 10, @context.objects.size
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../../test_helper')
|
2
2
|
|
3
3
|
describe ::Inch::CLI::Command::Options::BaseList do
|
4
4
|
it "should run parse without errors" do
|
@@ -10,7 +10,7 @@ describe ::Inch::CLI::Command::Options::BaseList do
|
|
10
10
|
assert @options.undocumented.nil?
|
11
11
|
assert @options.depth.nil?
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
it "should run parse twice without affecting the second run" do
|
15
15
|
@options = ::Inch::CLI::Command::Options::BaseList.new
|
16
16
|
@options.parse(["--no-public", "--no-protected", "--private"])
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
2
2
|
|
3
3
|
describe ::Inch::CLI::CommandParser do
|
4
4
|
before do
|
@@ -8,7 +8,7 @@ describe ::Inch::CLI::CommandParser do
|
|
8
8
|
|
9
9
|
it "should run without args" do
|
10
10
|
out, err = capture_io do
|
11
|
-
@command = @command_parser.run
|
11
|
+
@command = @command_parser.run()
|
12
12
|
end
|
13
13
|
refute out.empty?, "there should be some output"
|
14
14
|
assert err.empty?, "there should be no errors"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
2
2
|
|
3
3
|
describe ::Inch::CLI::YardoptsHelper do
|
4
4
|
before do
|
@@ -9,7 +9,7 @@ describe ::Inch::CLI::YardoptsHelper do
|
|
9
9
|
|
10
10
|
it "should run without args" do
|
11
11
|
out, err = capture_io do
|
12
|
-
@command.run
|
12
|
+
@command.run()
|
13
13
|
end
|
14
14
|
refute out.empty?, "there should be some output"
|
15
15
|
assert err.empty?, "there should be no errors"
|
@@ -56,8 +56,7 @@ describe ::Inch::CLI::YardoptsHelper do
|
|
56
56
|
end
|
57
57
|
refute out.empty?, "there should be some output"
|
58
58
|
assert_match /\bUsage\b.+list/, out
|
59
|
-
#
|
60
|
-
# "--[no-]yardopts should be mentioned"
|
59
|
+
#assert_match /\b\-\-\[no\-\]yardopts\b/, out, "--[no-]yardopts should be mentioned"
|
61
60
|
assert err.empty?, "there should be no errors"
|
62
61
|
end
|
63
62
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../../test_helper')
|
2
2
|
|
3
3
|
describe ::Inch::CodeObject::Provider::YARD::Docstring do
|
4
4
|
let(:described_class) { ::Inch::CodeObject::Provider::YARD::Docstring }
|
@@ -7,8 +7,9 @@ describe ::Inch::CodeObject::Provider::YARD::Docstring do
|
|
7
7
|
# loose TomDoc compatibility
|
8
8
|
#
|
9
9
|
|
10
|
+
|
10
11
|
it "should notice things in tomdoc style docs" do
|
11
|
-
|
12
|
+
text = <<-DOC
|
12
13
|
Internal: Detects the Language of the blob.
|
13
14
|
|
14
15
|
param1 - String filename
|
@@ -18,7 +19,7 @@ param2 - String blob data. A block also maybe passed in for lazy
|
|
18
19
|
param3 - Optional String mode (defaults to nil)
|
19
20
|
|
20
21
|
Returns Language or nil.
|
21
|
-
|
22
|
+
DOC
|
22
23
|
docstring = described_class.new(text)
|
23
24
|
assert docstring.describes_internal_api?
|
24
25
|
assert docstring.mentions_parameter?(:param1)
|
@@ -33,7 +34,7 @@ Returns Language or nil.
|
|
33
34
|
end
|
34
35
|
|
35
36
|
it "should notice things in tomdoc style docs 2" do
|
36
|
-
|
37
|
+
text = <<-DOC
|
37
38
|
Public: Look up Language by one of its aliases.
|
38
39
|
|
39
40
|
param1 - A String alias of the Language
|
@@ -44,7 +45,7 @@ Examples
|
|
44
45
|
# => #<Language name="C++">
|
45
46
|
|
46
47
|
Returns the Lexer or nil if none was found.
|
47
|
-
|
48
|
+
DOC
|
48
49
|
docstring = described_class.new(text)
|
49
50
|
assert docstring.mentions_parameter?(:param1)
|
50
51
|
assert docstring.describes_parameter?(:param1)
|
@@ -55,33 +56,8 @@ Returns the Lexer or nil if none was found.
|
|
55
56
|
assert docstring.describes_return?
|
56
57
|
end
|
57
58
|
|
58
|
-
it "should notice multi-line returns in tomdoc style docs" do
|
59
|
-
text = <<-DOC
|
60
|
-
Public: Look up Language by one of its aliases.
|
61
|
-
|
62
|
-
Returns the Lexer or nil
|
63
|
-
if none was found.
|
64
|
-
DOC
|
65
|
-
docstring = described_class.new(text)
|
66
|
-
assert docstring.mentions_return?
|
67
|
-
assert docstring.describes_return?
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should notice multi-line returns in tomdoc style docs 2" do
|
71
|
-
text = <<-DOC
|
72
|
-
Public: Look up Language by one of its aliases.
|
73
|
-
|
74
|
-
Returns the Lexer or nil
|
75
|
-
if none
|
76
|
-
was found.
|
77
|
-
DOC
|
78
|
-
docstring = described_class.new(text)
|
79
|
-
assert docstring.mentions_return?
|
80
|
-
assert docstring.describes_return?
|
81
|
-
end
|
82
|
-
|
83
59
|
it "should notice things in tomdoc style docs 3" do
|
84
|
-
|
60
|
+
text = <<-DOC
|
85
61
|
Public: Look up Language by one of its aliases.
|
86
62
|
|
87
63
|
param1 - A String alias of the Language
|
@@ -92,7 +68,7 @@ Examples
|
|
92
68
|
# => #<Language name="C++">
|
93
69
|
|
94
70
|
Returns the Lexer or nil if none was found.
|
95
|
-
|
71
|
+
DOC
|
96
72
|
docstring = described_class.new(text)
|
97
73
|
assert docstring.mentions_parameter?(:param1)
|
98
74
|
assert docstring.describes_parameter?(:param1)
|
@@ -103,80 +79,42 @@ Returns the Lexer or nil if none was found.
|
|
103
79
|
assert docstring.describes_return?
|
104
80
|
end
|
105
81
|
|
106
|
-
it "should understand 'Returns nil.'" do
|
107
|
-
text = <<-DOC
|
108
|
-
[...]
|
109
|
-
Returns nil.
|
110
|
-
DOC
|
111
|
-
docstring = described_class.new(text)
|
112
|
-
assert docstring.describes_return?
|
113
|
-
end
|
114
|
-
|
115
|
-
it "should understand 'Returns nil.' without fullstop and in lowercase" do
|
116
|
-
text = <<-DOC
|
117
|
-
[...]
|
118
|
-
returns nil
|
119
|
-
DOC
|
120
|
-
docstring = described_class.new(text)
|
121
|
-
assert docstring.describes_return?
|
122
|
-
end
|
123
|
-
|
124
|
-
it "should understand 'Returns nothing.'" do
|
125
|
-
text = <<-DOC
|
126
|
-
[...]
|
127
|
-
Returns nothing.
|
128
|
-
DOC
|
129
|
-
docstring = described_class.new(text)
|
130
|
-
assert docstring.describes_return?
|
131
|
-
end
|
132
|
-
|
133
|
-
it "should understand 'Returns nothing.' without fullstop and in lowercase" do
|
134
|
-
text = <<-DOC
|
135
|
-
[...]
|
136
|
-
returns nothing
|
137
|
-
DOC
|
138
|
-
docstring = described_class.new(text)
|
139
|
-
assert docstring.describes_return?
|
140
|
-
end
|
141
|
-
|
142
|
-
it "should understand 'Returns ...' with a visibility modifier in front of" \
|
143
|
-
" it" do
|
144
|
-
text = "Public: Returns the Integer color."
|
145
|
-
docstring = described_class.new(text)
|
146
|
-
assert docstring.mentions_return?
|
147
|
-
assert docstring.describes_return?
|
148
|
-
end
|
149
82
|
|
150
83
|
#
|
151
84
|
# PARAMETER MENTIONS
|
152
85
|
#
|
153
86
|
|
87
|
+
|
154
88
|
it "should work 2" do
|
155
|
-
|
89
|
+
text = <<-DOC
|
156
90
|
Just because format_html is mentioned here, does not mean
|
157
91
|
the first parameter is mentioned.
|
158
|
-
|
92
|
+
DOC
|
159
93
|
docstring = described_class.new(text)
|
160
94
|
refute docstring.mentions_parameter?(:format)
|
161
95
|
refute docstring.contains_code_example?
|
162
96
|
end
|
163
97
|
|
164
|
-
|
165
|
-
|
98
|
+
|
99
|
+
it "should work 2" do
|
100
|
+
text = <<-DOC
|
166
101
|
Just because format is mentioned here, does not mean
|
167
102
|
the first parameter is meant.
|
168
|
-
|
103
|
+
DOC
|
169
104
|
docstring = described_class.new(text)
|
170
105
|
refute docstring.mentions_parameter?(:format)
|
171
106
|
refute docstring.contains_code_example?
|
172
107
|
end
|
173
108
|
|
109
|
+
|
110
|
+
|
174
111
|
#
|
175
112
|
# CODE EXAMPLES
|
176
113
|
#
|
177
114
|
|
115
|
+
|
178
116
|
it "should work 3" do
|
179
|
-
|
117
|
+
text = <<-DOC
|
180
118
|
An example of a method using RDoc rather than YARD.
|
181
119
|
|
182
120
|
== Parameters:
|
@@ -185,13 +123,13 @@ param1::
|
|
185
123
|
|
186
124
|
== Returns:
|
187
125
|
A string in the specified format.
|
188
|
-
|
126
|
+
DOC
|
189
127
|
docstring = described_class.new(text)
|
190
128
|
refute docstring.contains_code_example?
|
191
129
|
end
|
192
130
|
|
193
131
|
it "should work with code example" do
|
194
|
-
|
132
|
+
text = <<-DOC
|
195
133
|
Another example.
|
196
134
|
|
197
135
|
method_with_code_example() # => some value
|
@@ -200,7 +138,7 @@ Params:
|
|
200
138
|
+param1+:: param1 line string to be executed by the system
|
201
139
|
+param2+:: +Proc+ object that takes a pipe object as first and only param (may be nil)
|
202
140
|
+param3+:: +Proc+ object that takes a pipe object as first and only param (may be nil)
|
203
|
-
|
141
|
+
DOC
|
204
142
|
docstring = described_class.new(text)
|
205
143
|
assert docstring.contains_code_example?
|
206
144
|
assert docstring.mentions_parameter?(:param1)
|
@@ -211,37 +149,21 @@ Params:
|
|
211
149
|
assert docstring.describes_parameter?(:param3)
|
212
150
|
end
|
213
151
|
|
214
|
-
it "should recognize several parameter notations" do
|
215
|
-
text = <<-DOC
|
216
|
-
Params:
|
217
|
-
+param1<String>+:: param1 line string to be executed by the system
|
218
|
-
+param2<String,nil>+:: +Proc+ object that takes a pipe object as first and only param (may be nil)
|
219
|
-
+param3<String|Class>+:: +Proc+ object that takes a pipe object as first and only param (may be nil)
|
220
|
-
DOC
|
221
|
-
docstring = described_class.new(text)
|
222
|
-
assert docstring.mentions_parameter?(:param1), "should mention param1"
|
223
|
-
assert docstring.mentions_parameter?(:param2), "should mention param2"
|
224
|
-
assert docstring.mentions_parameter?(:param3), "should mention param3"
|
225
|
-
assert docstring.describes_parameter?(:param1), "should describe param1"
|
226
|
-
assert docstring.describes_parameter?(:param2), "should describe param2"
|
227
|
-
assert docstring.describes_parameter?(:param3), "should describe param3"
|
228
|
-
end
|
229
|
-
|
230
152
|
it "should work with code example 2" do
|
231
|
-
|
153
|
+
text = <<-DOC
|
232
154
|
Just because format_html is mentioned here, does not mean
|
233
155
|
the first parameter is mentioned.
|
234
156
|
|
235
157
|
method_with_code_example() # => some value
|
236
158
|
method_with_missing_param_doc(param1, param2, param3)
|
237
|
-
|
159
|
+
DOC
|
238
160
|
docstring = described_class.new(text)
|
239
161
|
assert docstring.contains_code_example?
|
240
162
|
assert_equal 1, docstring.code_examples.size
|
241
163
|
end
|
242
164
|
|
243
165
|
it "should work with code example 3" do
|
244
|
-
|
166
|
+
text = <<-DOC
|
245
167
|
An example of a method using RDoc rather than YARD.
|
246
168
|
|
247
169
|
method_with_code_example() # => some value
|
@@ -252,7 +174,7 @@ param1::
|
|
252
174
|
|
253
175
|
== Returns:
|
254
176
|
A string in the specified format.
|
255
|
-
|
177
|
+
DOC
|
256
178
|
docstring = described_class.new(text)
|
257
179
|
assert docstring.contains_code_example?
|
258
180
|
assert_equal 1, docstring.code_examples.size
|
@@ -261,7 +183,7 @@ A string in the specified format.
|
|
261
183
|
end
|
262
184
|
|
263
185
|
it "should work with multiple code examples" do
|
264
|
-
|
186
|
+
text = <<-DOC
|
265
187
|
An example of a method using RDoc rather than YARD.
|
266
188
|
|
267
189
|
method_with_code_example() # => some value
|
@@ -277,7 +199,7 @@ param1::
|
|
277
199
|
|
278
200
|
== Returns:
|
279
201
|
A string in the specified format.
|
280
|
-
|
202
|
+
DOC
|
281
203
|
docstring = described_class.new(text)
|
282
204
|
assert docstring.contains_code_example?
|
283
205
|
assert_equal 2, docstring.code_examples.size
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../../test_helper')
|
2
2
|
|
3
3
|
describe ::Inch::CodeObject::Provider::YARD::NodocHelper do
|
4
4
|
before do
|
@@ -17,9 +17,9 @@ describe ::Inch::CodeObject::Provider::YARD::NodocHelper do
|
|
17
17
|
"Foo::HiddenClass::EvenMoreHiddenClass",
|
18
18
|
"Foo::HiddenClass::EvenMoreHiddenClass#method_with_implicit_nodoc",
|
19
19
|
"Foo::HiddenClassViaTag",
|
20
|
-
"Foo::HiddenClassViaTag#some_value"
|
20
|
+
"Foo::HiddenClassViaTag#some_value",
|
21
21
|
].each do |query|
|
22
|
-
m = @objects.
|
22
|
+
m = @objects.detect { |o| o.fullname == query }
|
23
23
|
assert m.nodoc?, "nodoc? should return true for #{query}"
|
24
24
|
end
|
25
25
|
end
|
@@ -30,10 +30,9 @@ describe ::Inch::CodeObject::Provider::YARD::NodocHelper do
|
|
30
30
|
"Foo::Qux::Quux::PUBLIC_VALUE",
|
31
31
|
"Foo::Qux::DOCCED_VALUE",
|
32
32
|
"Foo::HiddenClass::EvenMoreHiddenClass::SuddenlyVisibleClass",
|
33
|
-
"Foo::HiddenClass::EvenMoreHiddenClass::SuddenlyVisibleClass"
|
34
|
-
"#method_with_implicit_doc"
|
33
|
+
"Foo::HiddenClass::EvenMoreHiddenClass::SuddenlyVisibleClass#method_with_implicit_doc",
|
35
34
|
].each do |query|
|
36
|
-
m = @objects.
|
35
|
+
m = @objects.detect { |o| o.fullname == query }
|
37
36
|
refute m.nodoc?, "nodoc? should return false for #{query}"
|
38
37
|
end
|
39
38
|
end
|