inch 0.5.0.rc5 → 0.5.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -6
- data/.rubocop_todo.yml +40 -34
- data/Gemfile +3 -3
- data/Rakefile +10 -6
- data/bin/inch +5 -5
- data/config/base.rb +4 -4
- data/config/nodejs.rb +44 -1
- data/config/ruby.rb +1 -1
- data/inch.gemspec +17 -17
- data/lib/inch.rb +13 -13
- data/lib/inch/api.rb +10 -10
- data/lib/inch/api/compare.rb +2 -2
- data/lib/inch/api/compare/code_objects.rb +1 -1
- data/lib/inch/api/diff.rb +1 -1
- data/lib/inch/api/options/suggest.rb +1 -1
- data/lib/inch/api/suggest.rb +1 -1
- data/lib/inch/cli.rb +6 -6
- data/lib/inch/cli/command.rb +15 -15
- data/lib/inch/cli/command/base.rb +5 -3
- data/lib/inch/cli/command/base_list.rb +0 -1
- data/lib/inch/cli/command/console.rb +5 -5
- data/lib/inch/cli/command/diff.rb +6 -6
- data/lib/inch/cli/command/inspect.rb +5 -5
- data/lib/inch/cli/command/list.rb +4 -4
- data/lib/inch/cli/command/options/base.rb +17 -15
- data/lib/inch/cli/command/options/base_list.rb +17 -17
- data/lib/inch/cli/command/options/base_object.rb +1 -1
- data/lib/inch/cli/command/options/console.rb +13 -13
- data/lib/inch/cli/command/options/diff.rb +19 -19
- data/lib/inch/cli/command/options/inspect.rb +5 -5
- data/lib/inch/cli/command/options/list.rb +7 -7
- data/lib/inch/cli/command/options/show.rb +5 -5
- data/lib/inch/cli/command/options/stats.rb +2 -2
- data/lib/inch/cli/command/options/suggest.rb +12 -12
- data/lib/inch/cli/command/output/base.rb +1 -1
- data/lib/inch/cli/command/output/diff.rb +9 -9
- data/lib/inch/cli/command/output/inspect.rb +13 -13
- data/lib/inch/cli/command/output/list.rb +1 -1
- data/lib/inch/cli/command/output/show.rb +4 -4
- data/lib/inch/cli/command/output/stats.rb +14 -14
- data/lib/inch/cli/command/output/suggest.rb +14 -14
- 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 +4 -4
- data/lib/inch/cli/command_parser.rb +4 -4
- data/lib/inch/cli/sparkline_helper.rb +1 -1
- data/lib/inch/cli/trace_helper.rb +1 -1
- data/lib/inch/cli/yardopts_helper.rb +1 -1
- data/lib/inch/code_object.rb +3 -3
- data/lib/inch/code_object/provider.rb +3 -3
- data/lib/inch/code_object/proxy.rb +3 -4
- data/lib/inch/codebase.rb +5 -5
- data/lib/inch/codebase/object.rb +2 -1
- data/lib/inch/codebase/serializer.rb +2 -2
- data/lib/inch/config.rb +6 -6
- data/lib/inch/config/codebase.rb +5 -5
- data/lib/inch/core_ext.rb +1 -1
- data/lib/inch/core_ext/string.rb +1 -1
- data/lib/inch/evaluation.rb +8 -8
- data/lib/inch/evaluation/proxy.rb +2 -3
- data/lib/inch/evaluation/role.rb +1 -1
- data/lib/inch/language/elixir/code_object/base.rb +6 -4
- data/lib/inch/language/elixir/evaluation/base.rb +2 -1
- data/lib/inch/language/elixir/evaluation/function_object.rb +1 -1
- data/lib/inch/language/elixir/import.rb +14 -14
- data/lib/inch/language/elixir/provider/reader.rb +1 -1
- data/lib/inch/language/elixir/provider/reader/docstring.rb +13 -0
- data/lib/inch/language/elixir/provider/reader/object.rb +5 -5
- data/lib/inch/language/elixir/provider/reader/object/base.rb +13 -5
- data/lib/inch/language/elixir/provider/reader/object/function_object.rb +1 -1
- data/lib/inch/language/elixir/provider/reader/parser.rb +21 -7
- data/lib/inch/language/elixir/roles/base.rb +3 -3
- data/lib/inch/language/elixir/roles/function.rb +2 -1
- data/lib/inch/language/elixir/roles/object.rb +1 -1
- data/lib/inch/language/nodejs/code_object/base.rb +199 -0
- data/lib/inch/language/nodejs/code_object/function_object.rb +74 -0
- data/lib/inch/language/nodejs/code_object/member_object.rb +11 -0
- data/lib/inch/language/nodejs/code_object/module_object.rb +23 -0
- data/lib/inch/language/nodejs/evaluation/base.rb +29 -0
- data/lib/inch/language/nodejs/evaluation/function_object.rb +31 -0
- data/lib/inch/language/nodejs/evaluation/member_object.rb +11 -0
- data/lib/inch/language/nodejs/evaluation/module_object.rb +27 -0
- data/lib/inch/language/nodejs/import.rb +17 -1
- data/lib/inch/language/nodejs/provider/jsdoc.rb +1 -1
- data/lib/inch/language/nodejs/provider/jsdoc/docstring.rb +13 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object.rb +16 -8
- data/lib/inch/language/nodejs/provider/jsdoc/object/base.rb +82 -45
- data/lib/inch/language/nodejs/provider/jsdoc/object/function_object.rb +18 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object/member_object.rb +15 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object/module_object.rb +22 -0
- data/lib/inch/language/nodejs/provider/jsdoc/parser.rb +9 -10
- data/lib/inch/language/nodejs/roles/base.rb +32 -0
- data/lib/inch/language/nodejs/roles/function.rb +113 -0
- data/lib/inch/language/nodejs/roles/member.rb +13 -0
- data/lib/inch/language/nodejs/roles/module.rb +64 -0
- data/lib/inch/language/nodejs/roles/object.rb +76 -0
- data/lib/inch/language/ruby/code_object/base.rb +6 -4
- data/lib/inch/language/ruby/evaluation/base.rb +2 -1
- data/lib/inch/language/ruby/evaluation/method_object.rb +2 -1
- data/lib/inch/language/ruby/import.rb +24 -24
- data/lib/inch/language/ruby/provider/yard.rb +10 -10
- data/lib/inch/language/ruby/provider/yard/nodoc_helper.rb +2 -2
- data/lib/inch/language/ruby/provider/yard/object.rb +9 -9
- data/lib/inch/language/ruby/provider/yard/object/base.rb +25 -28
- data/lib/inch/language/ruby/provider/yard/object/method_object.rb +4 -3
- data/lib/inch/language/ruby/provider/yard/object/method_parameter_object.rb +4 -3
- data/lib/inch/language/ruby/provider/yard/object/method_signature.rb +2 -2
- data/lib/inch/language/ruby/provider/yard/object/namespace_object.rb +2 -1
- data/lib/inch/language/ruby/provider/yard/parser.rb +2 -2
- data/lib/inch/language/ruby/roles/base.rb +1 -1
- data/lib/inch/language/ruby/roles/method.rb +2 -1
- data/lib/inch/language/ruby/roles/method_parameter.rb +1 -1
- data/lib/inch/language/ruby/roles/missing.rb +2 -2
- data/lib/inch/language/ruby/roles/object.rb +6 -6
- data/lib/inch/rake.rb +2 -2
- data/lib/inch/rake/suggest.rb +5 -5
- data/lib/inch/utils/code_location.rb +12 -0
- data/lib/inch/utils/read_write_methods.rb +2 -2
- data/lib/inch/utils/ui.rb +8 -8
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/elixir/simple/all.json +321 -0
- data/test/integration/api/compare/codebases.rb +6 -6
- data/test/integration/cli/command/console_test.rb +13 -13
- data/test/integration/cli/command/diff_test.rb +12 -14
- data/test/integration/cli/command/inspect_test.rb +30 -30
- data/test/integration/cli/command/list_test.rb +34 -34
- data/test/integration/cli/command/show_test.rb +26 -26
- data/test/integration/cli/command/stats_test.rb +23 -23
- data/test/integration/cli/command/suggest_test.rb +58 -49
- data/test/integration/stats_options_test.rb +9 -9
- data/test/integration/visibility_options_test.rb +49 -45
- data/test/shared/base_list.rb +41 -41
- data/test/test_helper.rb +18 -10
- data/test/unit/api/filter_test.rb +9 -9
- data/test/unit/api/get_test.rb +6 -6
- data/test/unit/api/list_test.rb +3 -3
- data/test/unit/api/options/base_test.rb +6 -6
- data/test/unit/api/stats_test.rb +3 -3
- data/test/unit/api/suggest_test.rb +4 -4
- data/test/unit/cli/arguments_test.rb +25 -25
- data/test/unit/cli/command/base_test.rb +3 -3
- data/test/unit/cli/command/options/base_list_test.rb +14 -14
- data/test/unit/cli/command/options/base_object_test.rb +6 -6
- data/test/unit/cli/command/options/base_test.rb +3 -3
- data/test/unit/cli/command_parser_test.rb +29 -29
- data/test/unit/cli/trace_helper_test.rb +2 -2
- data/test/unit/cli/yardopts_helper_test.rb +35 -35
- data/test/unit/code_object/converter_test.rb +3 -3
- data/test/unit/code_object/provider_test.rb +2 -2
- data/test/unit/code_object/proxy_test.rb +11 -11
- data/test/unit/codebase/objects_test.rb +8 -8
- data/test/unit/codebase/proxy_test.rb +5 -5
- data/test/unit/config/codebase_test.rb +3 -3
- data/test/unit/config_test.rb +4 -4
- data/test/unit/evaluation/role_test.rb +8 -8
- data/test/unit/language/elixir/code_object/function_object_test.rb +35 -0
- data/test/unit/language/ruby/code_object/method_object_test.rb +128 -126
- data/test/unit/language/ruby/provider/yard/docstring_test.rb +27 -23
- data/test/unit/language/ruby/provider/yard/nodoc_helper_test.rb +21 -20
- data/test/unit/language/ruby/provider/yard/object/method_object_test.rb +20 -17
- data/test/unit/language/ruby/provider/yard_test.rb +4 -4
- data/test/unit/utils/buffered_ui_test.rb +20 -20
- data/test/unit/utils/ui_test.rb +20 -20
- data/test/unit/utils/weighted_list_test.rb +7 -7
- metadata +25 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
|
2
2
|
require 'inch/utils/buffered_ui'
|
3
3
|
|
4
4
|
describe ::Inch::CLI::Command::Suggest do
|
@@ -7,39 +7,39 @@ describe ::Inch::CLI::Command::Suggest do
|
|
7
7
|
@command = ::Inch::CLI::Command::Suggest
|
8
8
|
end
|
9
9
|
|
10
|
-
it
|
10
|
+
it 'should run without args' do
|
11
11
|
out, err = capture_io do
|
12
12
|
@command.run
|
13
13
|
end
|
14
|
-
refute out.empty?,
|
15
|
-
assert err.empty?,
|
16
|
-
assert_match
|
17
|
-
assert_match
|
18
|
-
assert_match
|
14
|
+
refute out.empty?, 'there should be some output'
|
15
|
+
assert err.empty?, 'there should be no errors'
|
16
|
+
assert_match(/\bFoo::Bar#method_with_wrong_doc\b/, out)
|
17
|
+
assert_match(/\bFoo::Bar#method_with_rdoc_doc\b/, out)
|
18
|
+
assert_match(/\bFoo::Bar#method_with_unstructured_doc\b/, out)
|
19
19
|
end
|
20
20
|
|
21
|
-
it
|
21
|
+
it 'should run with --pedantic switch' do
|
22
22
|
out, err = capture_io do
|
23
|
-
@command.run(
|
23
|
+
@command.run('--pedantic')
|
24
24
|
end
|
25
|
-
refute out.empty?,
|
26
|
-
assert err.empty?,
|
25
|
+
refute out.empty?, 'there should be some output'
|
26
|
+
assert err.empty?, 'there should be no errors'
|
27
27
|
end
|
28
28
|
|
29
|
-
it
|
29
|
+
it 'should run with filelist in args' do
|
30
30
|
out, err = capture_io do
|
31
|
-
@command.run(
|
31
|
+
@command.run('lib/**/*.rb', 'app/**/*.rb')
|
32
32
|
end
|
33
|
-
refute out.empty?,
|
34
|
-
assert err.empty?,
|
35
|
-
assert_match
|
36
|
-
assert_match
|
37
|
-
assert_match
|
33
|
+
refute out.empty?, 'there should be some output'
|
34
|
+
assert err.empty?, 'there should be no errors'
|
35
|
+
assert_match(/\bFoo::Bar#method_with_wrong_doc\b/, out)
|
36
|
+
assert_match(/\bFoo::Bar#method_with_rdoc_doc\b/, out)
|
37
|
+
assert_match(/\bFoo::Bar#method_with_unstructured_doc\b/, out)
|
38
38
|
end
|
39
39
|
|
40
|
-
it
|
40
|
+
it 'should run with non-existing filelist in args' do
|
41
41
|
_out, _err = capture_io do
|
42
|
-
@command.run(
|
42
|
+
@command.run('app/**/*.rb')
|
43
43
|
end
|
44
44
|
# TODO: not sure what should actually happen here:
|
45
45
|
# no output or error message?
|
@@ -47,68 +47,77 @@ describe ::Inch::CLI::Command::Suggest do
|
|
47
47
|
# assert err.empty?, "there should be no errors"
|
48
48
|
end
|
49
49
|
|
50
|
-
it
|
50
|
+
it 'should run with --objects switch' do
|
51
51
|
out, err = capture_io do
|
52
|
-
@command.run(
|
52
|
+
@command.run('lib/**/*.rb', 'app/**/*.rb', '--objects=30')
|
53
53
|
end
|
54
|
-
refute out.empty?,
|
55
|
-
assert err.empty?,
|
56
|
-
assert_match
|
57
|
-
assert_match
|
58
|
-
assert_match
|
54
|
+
refute out.empty?, 'there should be some output'
|
55
|
+
assert err.empty?, 'there should be no errors'
|
56
|
+
assert_match(/\bFoo::Bar#method_with_wrong_doc\b/, out)
|
57
|
+
assert_match(/\bFoo::Bar#method_with_rdoc_doc\b/, out)
|
58
|
+
assert_match(/\bFoo::Bar#method_with_unstructured_doc\b/, out)
|
59
59
|
end
|
60
60
|
|
61
|
-
it
|
61
|
+
it 'should give error when run with --unknown-switch' do
|
62
62
|
_out, _err = capture_io do
|
63
|
-
assert_raises(SystemExit) { @command.run(
|
63
|
+
assert_raises(SystemExit) { @command.run('--unknown-switch') }
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
it
|
67
|
+
it 'should output info when run with --help' do
|
68
68
|
out, err = capture_io do
|
69
|
-
assert_raises(SystemExit) { @command.run(
|
69
|
+
assert_raises(SystemExit) { @command.run('--help') }
|
70
70
|
end
|
71
|
-
refute out.empty?,
|
72
|
-
assert_match
|
73
|
-
assert err.empty?,
|
71
|
+
refute out.empty?, 'there should be some output'
|
72
|
+
assert_match(/\bUsage\b.+suggest/, out)
|
73
|
+
assert err.empty?, 'there should be no errors'
|
74
74
|
end
|
75
75
|
|
76
|
-
it
|
76
|
+
it 'should output version when run with --version' do
|
77
77
|
out, err = capture_io do
|
78
|
-
assert_raises(SystemExit) { @command.run(
|
78
|
+
assert_raises(SystemExit) { @command.run('--version') }
|
79
79
|
end
|
80
|
-
refute out.empty?,
|
81
|
-
assert_match
|
82
|
-
assert err.empty?,
|
80
|
+
refute out.empty?, 'there should be some output'
|
81
|
+
assert_match(/inch\ \d\.\d\.\d/, out)
|
82
|
+
assert err.empty?, 'there should be no errors'
|
83
83
|
end
|
84
84
|
|
85
|
-
it
|
85
|
+
it 'should not output anything to stdout when used with BufferedUI' do
|
86
86
|
ui = ::Inch::Utils::BufferedUI.new
|
87
87
|
out, err = capture_io do
|
88
88
|
@command.run(:ui => ui)
|
89
89
|
end
|
90
|
-
assert out.empty?,
|
91
|
-
assert err.empty?,
|
90
|
+
assert out.empty?, 'there should be no output'
|
91
|
+
assert err.empty?, 'there should be no errors'
|
92
92
|
end
|
93
93
|
|
94
94
|
# Edge case: Really good codebase
|
95
95
|
|
96
|
-
it
|
96
|
+
it 'should run without args on really good fixture' do
|
97
97
|
out, err = capture_io do
|
98
98
|
Dir.chdir fixture_path(:ruby, :really_good)
|
99
99
|
@command.run
|
100
100
|
end
|
101
|
-
refute out.empty?,
|
102
|
-
assert err.empty?,
|
101
|
+
refute out.empty?, 'there should be some output'
|
102
|
+
assert err.empty?, 'there should be no errors'
|
103
103
|
end
|
104
104
|
|
105
|
-
it
|
105
|
+
it 'should run with --pedantic switch' do
|
106
106
|
out, err = capture_io do
|
107
107
|
Dir.chdir fixture_path(:ruby, :really_good)
|
108
|
-
@command.run(
|
108
|
+
@command.run('--pedantic')
|
109
109
|
end
|
110
|
-
refute out.empty?,
|
111
|
-
assert err.empty?,
|
110
|
+
refute out.empty?, 'there should be some output'
|
111
|
+
assert err.empty?, 'there should be no errors'
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'should run on elixir codebase with --read-from-dump' do
|
115
|
+
out, err = capture_io do
|
116
|
+
Dir.chdir fixture_path(:elixir, :simple)
|
117
|
+
@command.run('--language=elixir', '--read-from-dump=all.json')
|
118
|
+
end
|
119
|
+
refute out.empty?, 'there should be some output'
|
120
|
+
assert err.empty?, 'there should be no errors'
|
112
121
|
end
|
113
122
|
|
114
123
|
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
|
#
|
4
4
|
# These format tests also broke things in the regular testsuite.
|
@@ -9,25 +9,25 @@ require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
|
|
9
9
|
describe ::Inch::CLI::Command::List do
|
10
10
|
before do
|
11
11
|
Dir.chdir fixture_path(:ruby, :simple)
|
12
|
-
@command =
|
12
|
+
@command = 'bundle exec inch stats'
|
13
13
|
end
|
14
14
|
|
15
15
|
def assert_parsed_output(parsed)
|
16
16
|
assert parsed.size > 0
|
17
|
-
assert parsed[
|
18
|
-
assert parsed[
|
19
|
-
assert parsed[
|
17
|
+
assert parsed['grade_lists']
|
18
|
+
assert parsed['scores']
|
19
|
+
assert parsed['priorities']
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
22
|
+
it 'should run with --no-private switch' do
|
23
23
|
out = `#{@command} --format json`
|
24
|
-
refute out.empty?,
|
24
|
+
refute out.empty?, 'there should be some output'
|
25
25
|
assert_parsed_output JSON[out]
|
26
26
|
end
|
27
27
|
|
28
|
-
it
|
28
|
+
it 'should run with --no-protected switch' do
|
29
29
|
out = `#{@command} --format yaml`
|
30
|
-
refute out.empty?,
|
30
|
+
refute out.empty?, 'there should be some output'
|
31
31
|
assert_parsed_output YAML.load(out)
|
32
32
|
end
|
33
33
|
|
@@ -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 do
|
4
4
|
before do
|
@@ -6,81 +6,85 @@ describe ::Inch::CLI::Command do
|
|
6
6
|
@command = ::Inch::CLI::Command::List
|
7
7
|
end
|
8
8
|
|
9
|
-
it
|
9
|
+
it 'should run without visibility switches' do
|
10
10
|
out, _err = capture_io do
|
11
|
-
@command.run(
|
11
|
+
@command.run('--all')
|
12
12
|
end
|
13
|
-
refute out.empty?,
|
14
|
-
assert_match
|
15
|
-
assert_match
|
16
|
-
refute_match
|
17
|
-
refute_match
|
13
|
+
refute out.empty?, 'there should be some output'
|
14
|
+
assert_match(/\bFoo#public_method\b/, out)
|
15
|
+
assert_match(/\bFoo#protected_method\b/, out)
|
16
|
+
refute_match(/\bFoo#private_method\b/, out) # has @private tag
|
17
|
+
refute_match(/\bFoo#method_with_private_tag\b/, out) # has @private tag
|
18
18
|
end
|
19
19
|
|
20
|
-
it
|
20
|
+
it 'should run with --no-protected switch' do
|
21
21
|
out, _err = capture_io do
|
22
|
-
@command.run(
|
22
|
+
@command.run('--all', '--no-protected')
|
23
23
|
end
|
24
|
-
refute out.empty?,
|
25
|
-
assert_match
|
26
|
-
refute_match
|
27
|
-
refute_match
|
28
|
-
refute_match
|
24
|
+
refute out.empty?, 'there should be some output'
|
25
|
+
assert_match(/\bFoo#public_method\b/, out)
|
26
|
+
refute_match(/\bFoo#protected_method\b/, out)
|
27
|
+
refute_match(/\bFoo#private_method\b/, out) # has @private tag
|
28
|
+
refute_match(/\bFoo#method_with_private_tag\b/, out) # has @private tag
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
31
|
+
it 'should run with --no-public switch' do
|
32
32
|
out, _err = capture_io do
|
33
33
|
@command.run(*%w(--all --no-public))
|
34
34
|
end
|
35
|
-
refute out.empty?,
|
36
|
-
refute_match
|
37
|
-
assert_match
|
38
|
-
refute_match
|
39
|
-
refute_match
|
35
|
+
refute out.empty?, 'there should be some output'
|
36
|
+
refute_match(/\bFoo#public_method\b/, out)
|
37
|
+
assert_match(/\bFoo#protected_method\b/, out)
|
38
|
+
refute_match(/\bFoo#private_method\b/, out) # has @private tag
|
39
|
+
refute_match(/\bFoo#method_with_private_tag\b/, out) # has @private tag
|
40
40
|
end
|
41
41
|
|
42
|
-
it
|
42
|
+
it 'should run with --no-public --no-protected switch' do
|
43
43
|
out, _err = capture_io do
|
44
44
|
@command.run(*%w(--all --no-public --no-protected))
|
45
45
|
end
|
46
|
-
assert out.empty?,
|
47
|
-
refute_match
|
48
|
-
refute_match
|
49
|
-
refute_match
|
50
|
-
|
46
|
+
assert out.empty?, 'there should be no output'
|
47
|
+
refute_match(/\bFoo#public_method\b/, out)
|
48
|
+
refute_match(/\bFoo#protected_method\b/, out)
|
49
|
+
refute_match(/\bFoo#private_method\b/, out) # has @private tag
|
50
|
+
# has a @private tag, but is really :public
|
51
|
+
refute_match(/\bFoo#method_with_private_tag\b/, out)
|
51
52
|
end
|
52
53
|
|
53
|
-
it
|
54
|
+
it 'should run with --no-public --no-protected --private switch' do
|
54
55
|
out, _err = capture_io do
|
55
56
|
@command.run(*%w(--all --no-public --no-protected --private))
|
56
57
|
end
|
57
|
-
refute out.empty?,
|
58
|
-
refute_match
|
59
|
-
refute_match
|
60
|
-
assert_match
|
61
|
-
|
58
|
+
refute out.empty?, 'there should be some output'
|
59
|
+
refute_match(/\bFoo#public_method\b/, out)
|
60
|
+
refute_match(/\bFoo#protected_method\b/, out)
|
61
|
+
assert_match(/\bFoo#private_method\b/, out) # has @private tag
|
62
|
+
# has a @private tag, but is really :public
|
63
|
+
refute_match(/\bFoo#method_with_private_tag\b/, out)
|
62
64
|
end
|
63
65
|
|
64
|
-
it
|
66
|
+
it 'should run with --no-public switch' do
|
65
67
|
out, _err = capture_io do
|
66
68
|
@command.run(*%w(--all --no-public))
|
67
69
|
end
|
68
|
-
refute out.empty?,
|
69
|
-
refute_match
|
70
|
-
assert_match
|
71
|
-
refute_match
|
72
|
-
|
70
|
+
refute out.empty?, 'there should be some output'
|
71
|
+
refute_match(/\bFoo#public_method\b/, out)
|
72
|
+
assert_match(/\bFoo#protected_method\b/, out)
|
73
|
+
refute_match(/\bFoo#private_method\b/, out) # has @private tag
|
74
|
+
# has a @private tag, but is really :public
|
75
|
+
refute_match(/\bFoo#method_with_private_tag\b/, out)
|
73
76
|
end
|
74
77
|
|
75
|
-
it
|
78
|
+
it 'should run with --no-protected switch' do
|
76
79
|
out, _err = capture_io do
|
77
80
|
@command.run(*%w(--all --no-protected))
|
78
81
|
end
|
79
|
-
refute out.empty?,
|
80
|
-
assert_match
|
81
|
-
refute_match
|
82
|
-
refute_match
|
83
|
-
|
82
|
+
refute out.empty?, 'there should be some output'
|
83
|
+
assert_match(/\bFoo#public_method\b/, out)
|
84
|
+
refute_match(/\bFoo#protected_method\b/, out)
|
85
|
+
refute_match(/\bFoo#private_method\b/, out) # has @private tag
|
86
|
+
# has a @private tag, but is really :public
|
87
|
+
refute_match(/\bFoo#method_with_private_tag\b/, out)
|
84
88
|
end
|
85
89
|
|
86
90
|
end
|
data/test/shared/base_list.rb
CHANGED
@@ -2,73 +2,73 @@ module Shared
|
|
2
2
|
module BaseList
|
3
3
|
extend Minitest::Spec::DSL
|
4
4
|
|
5
|
-
it
|
5
|
+
it 'should give error when run with --unknown-switch' do
|
6
6
|
_out, _err = capture_io do
|
7
7
|
assert_raises(SystemExit) do
|
8
|
-
@command.run(
|
8
|
+
@command.run('lib/foo.rb', '--unknown-switch')
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
13
|
+
it 'should run with --depth switch' do
|
14
14
|
out, err = capture_io do
|
15
|
-
@command.run(
|
15
|
+
@command.run('lib/foo.rb', '--depth=2')
|
16
16
|
end
|
17
|
-
refute out.empty?,
|
18
|
-
assert err.empty?,
|
19
|
-
assert_match
|
20
|
-
assert_match
|
21
|
-
refute_match
|
22
|
-
refute_match
|
17
|
+
refute out.empty?, 'there should be some output'
|
18
|
+
assert err.empty?, 'there should be no errors'
|
19
|
+
assert_match(/\bFoo\b/, out)
|
20
|
+
assert_match(/\bFoo::Bar\b/, out)
|
21
|
+
refute_match(/\bFoo::Bar#method_with_full_doc\b/, out)
|
22
|
+
refute_match(/\bFoo::Bar#method_with_code_example\b/, out)
|
23
23
|
end
|
24
24
|
|
25
|
-
it
|
25
|
+
it 'should run with --only-namespaces switch' do
|
26
26
|
out, err = capture_io do
|
27
|
-
@command.run(
|
27
|
+
@command.run('lib/foo.rb', '--only-namespaces')
|
28
28
|
end
|
29
|
-
refute out.empty?,
|
30
|
-
assert err.empty?,
|
31
|
-
assert_match
|
32
|
-
assert_match
|
33
|
-
refute_match
|
34
|
-
refute_match
|
29
|
+
refute out.empty?, 'there should be some output'
|
30
|
+
assert err.empty?, 'there should be no errors'
|
31
|
+
assert_match(/\bFoo\s/, out)
|
32
|
+
assert_match(/\bFoo::Bar\s/, out)
|
33
|
+
refute_match(/\bFoo::Bar\./, out)
|
34
|
+
refute_match(/\bFoo::Bar#/, out)
|
35
35
|
end
|
36
36
|
|
37
|
-
it
|
37
|
+
it 'should run with --no-namespaces switch' do
|
38
38
|
out, err = capture_io do
|
39
|
-
@command.run(
|
39
|
+
@command.run('lib/foo.rb', '--no-namespaces')
|
40
40
|
end
|
41
|
-
refute out.empty?,
|
42
|
-
assert err.empty?,
|
43
|
-
refute_match
|
44
|
-
refute_match
|
45
|
-
assert_match
|
41
|
+
refute out.empty?, 'there should be some output'
|
42
|
+
assert err.empty?, 'there should be no errors'
|
43
|
+
refute_match(/\bFoo\s/, out)
|
44
|
+
refute_match(/\bFoo::Bar\s/, out)
|
45
|
+
assert_match(/\bFoo::Bar#/, out)
|
46
46
|
end
|
47
47
|
|
48
|
-
it
|
48
|
+
it 'should run with --only-undocumented switch' do
|
49
49
|
skip
|
50
50
|
out, err = capture_io do
|
51
|
-
@command.run(
|
51
|
+
@command.run('lib/foo.rb', '--all', '--only-undocumented')
|
52
52
|
end
|
53
|
-
refute out.empty?,
|
54
|
-
assert err.empty?,
|
55
|
-
refute_match
|
56
|
-
refute_match
|
57
|
-
assert_match
|
58
|
-
assert_match
|
53
|
+
refute out.empty?, 'there should be some output'
|
54
|
+
assert err.empty?, 'there should be no errors'
|
55
|
+
refute_match(/\bFoo\s/, out)
|
56
|
+
refute_match(/\bFoo::Bar#method_with_full_doc\b/, out)
|
57
|
+
assert_match(/\bFoo::Bar\s/, out)
|
58
|
+
assert_match(/\bFoo::Bar#method_without_doc\b/, out)
|
59
59
|
end
|
60
60
|
|
61
|
-
it
|
61
|
+
it 'should run with --no-undocumented switch' do
|
62
62
|
skip
|
63
63
|
out, err = capture_io do
|
64
|
-
@command.run(
|
64
|
+
@command.run('lib/foo.rb', '--all', '--no-undocumented')
|
65
65
|
end
|
66
|
-
refute out.empty?,
|
67
|
-
assert err.empty?,
|
68
|
-
assert_match
|
69
|
-
assert_match
|
70
|
-
refute_match
|
71
|
-
refute_match
|
66
|
+
refute out.empty?, 'there should be some output'
|
67
|
+
assert err.empty?, 'there should be no errors'
|
68
|
+
assert_match(/\bFoo\s/, out)
|
69
|
+
assert_match(/\bFoo::Bar#method_with_full_doc\b/, out)
|
70
|
+
refute_match(/\bFoo::Bar\s/, out)
|
71
|
+
refute_match(/\bFoo::Bar#method_without_doc\b/, out)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|