inch 0.5.0.rc3 → 0.5.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +15 -0
- data/.rubocop_todo.yml +94 -0
- data/CHANGELOG.md +26 -2
- data/Gemfile +5 -2
- data/README.md +3 -3
- data/Rakefile +6 -2
- data/bin/inch +3 -3
- data/config/{example.yml → .inch.yml.sample} +1 -0
- data/config/base.rb +53 -0
- data/config/elixir.rb +43 -0
- data/config/nodejs.rb +10 -0
- data/config/{defaults.rb → ruby.rb} +5 -54
- data/inch.gemspec +7 -7
- data/lib/inch.rb +14 -9
- data/lib/inch/api.rb +10 -10
- data/lib/inch/api/compare.rb +2 -2
- data/lib/inch/api/compare/code_objects.rb +2 -3
- data/lib/inch/api/compare/codebases.rb +1 -1
- data/lib/inch/api/diff.rb +13 -16
- data/lib/inch/api/filter.rb +1 -1
- data/lib/inch/api/get.rb +2 -2
- data/lib/inch/api/options/base.rb +4 -4
- data/lib/inch/api/options/filter.rb +0 -4
- data/lib/inch/api/options/suggest.rb +2 -6
- data/lib/inch/api/stats.rb +0 -1
- data/lib/inch/api/suggest.rb +9 -10
- 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 +30 -9
- data/lib/inch/cli/command/base_list.rb +2 -2
- data/lib/inch/cli/command/console.rb +5 -5
- data/lib/inch/cli/command/diff.rb +9 -9
- data/lib/inch/cli/command/inspect.rb +5 -4
- data/lib/inch/cli/command/list.rb +4 -4
- data/lib/inch/cli/command/options/base.rb +17 -16
- data/lib/inch/cli/command/options/base_list.rb +9 -5
- data/lib/inch/cli/command/options/console.rb +4 -3
- data/lib/inch/cli/command/options/diff.rb +8 -6
- data/lib/inch/cli/command/options/inspect.rb +2 -2
- data/lib/inch/cli/command/options/list.rb +3 -2
- data/lib/inch/cli/command/options/show.rb +2 -2
- data/lib/inch/cli/command/options/stats.rb +2 -1
- data/lib/inch/cli/command/options/suggest.rb +6 -3
- data/lib/inch/cli/command/output/base.rb +4 -6
- data/lib/inch/cli/command/output/console.rb +6 -7
- data/lib/inch/cli/command/output/diff.rb +6 -6
- data/lib/inch/cli/command/output/inspect.rb +6 -8
- data/lib/inch/cli/command/output/list.rb +0 -1
- data/lib/inch/cli/command/output/show.rb +4 -5
- data/lib/inch/cli/command/output/stats.rb +21 -21
- data/lib/inch/cli/command/output/suggest.rb +31 -28
- 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 +6 -5
- 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 +4 -3
- data/lib/inch/code_object.rb +3 -3
- data/lib/inch/code_object/converter.rb +6 -8
- data/lib/inch/code_object/provider.rb +11 -11
- data/lib/inch/code_object/proxy.rb +61 -30
- data/lib/inch/codebase.rb +7 -8
- data/lib/inch/codebase/object.rb +60 -0
- data/lib/inch/codebase/objects.rb +8 -10
- data/lib/inch/codebase/objects_filter.rb +7 -5
- data/lib/inch/codebase/proxy.rb +4 -4
- data/lib/inch/codebase/serializer.rb +3 -3
- data/lib/inch/config.rb +42 -11
- data/lib/inch/config/base.rb +8 -29
- data/lib/inch/config/codebase.rb +32 -7
- data/lib/inch/config/evaluation.rb +61 -0
- data/lib/inch/core_ext.rb +1 -1
- data/lib/inch/core_ext/string.rb +1 -1
- data/lib/inch/evaluation.rb +13 -21
- data/lib/inch/evaluation/file.rb +4 -2
- data/lib/inch/evaluation/grade_list.rb +4 -4
- data/lib/inch/evaluation/priority_range.rb +3 -0
- data/lib/inch/evaluation/proxy.rb +139 -14
- data/lib/inch/evaluation/role.rb +99 -0
- data/lib/inch/language.rb +3 -0
- data/lib/inch/language/elixir/code_object/base.rb +197 -0
- data/lib/inch/language/elixir/code_object/function_object.rb +74 -0
- data/lib/inch/language/elixir/code_object/module_object.rb +23 -0
- data/lib/inch/language/elixir/code_object/type_object.rb +11 -0
- data/lib/inch/language/elixir/evaluation/base.rb +28 -0
- data/lib/inch/language/elixir/evaluation/function_object.rb +31 -0
- data/lib/inch/language/elixir/evaluation/module_object.rb +27 -0
- data/lib/inch/language/elixir/evaluation/type_object.rb +11 -0
- data/lib/inch/language/elixir/import.rb +24 -0
- data/lib/inch/language/elixir/provider/reader.rb +19 -0
- data/lib/inch/language/elixir/provider/reader/object.rb +63 -0
- data/lib/inch/language/elixir/provider/reader/object/base.rb +191 -0
- data/lib/inch/language/elixir/provider/reader/object/function_object.rb +26 -0
- data/lib/inch/language/elixir/provider/reader/object/module_object.rb +22 -0
- data/lib/inch/language/elixir/provider/reader/object/type_object.rb +15 -0
- data/lib/inch/language/elixir/provider/reader/parser.rb +55 -0
- data/lib/inch/language/elixir/roles/base.rb +32 -0
- data/lib/inch/language/elixir/roles/function.rb +112 -0
- data/lib/inch/language/elixir/roles/module.rb +64 -0
- data/lib/inch/language/elixir/roles/object.rb +76 -0
- data/lib/inch/language/elixir/roles/type.rb +13 -0
- data/lib/inch/language/nodejs/import.rb +8 -0
- data/lib/inch/language/nodejs/provider/jsdoc.rb +19 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object.rb +55 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object/base.rb +191 -0
- data/lib/inch/language/nodejs/provider/jsdoc/parser.rb +59 -0
- data/lib/inch/language/ruby/code_object/base.rb +197 -0
- data/lib/inch/language/ruby/code_object/class_object.rb +10 -0
- data/lib/inch/language/ruby/code_object/class_variable_object.rb +10 -0
- data/lib/inch/language/ruby/code_object/constant_object.rb +10 -0
- data/lib/inch/language/ruby/code_object/method_object.rb +85 -0
- data/lib/inch/language/ruby/code_object/method_parameter_object.rb +64 -0
- data/lib/inch/language/ruby/code_object/module_object.rb +10 -0
- data/lib/inch/language/ruby/code_object/namespace_object.rb +35 -0
- data/lib/inch/language/ruby/evaluation/base.rb +45 -0
- data/lib/inch/language/ruby/evaluation/class_object.rb +10 -0
- data/lib/inch/language/ruby/evaluation/class_variable_object.rb +21 -0
- data/lib/inch/language/ruby/evaluation/constant_object.rb +21 -0
- data/lib/inch/language/ruby/evaluation/method_object.rb +74 -0
- data/lib/inch/language/ruby/evaluation/module_object.rb +10 -0
- data/lib/inch/language/ruby/evaluation/namespace_object.rb +30 -0
- data/lib/inch/language/ruby/import.rb +34 -0
- data/lib/inch/language/ruby/provider/yard.rb +58 -0
- data/lib/inch/language/ruby/provider/yard/docstring.rb +162 -0
- data/lib/inch/language/ruby/provider/yard/nodoc_helper.rb +97 -0
- data/lib/inch/language/ruby/provider/yard/object.rb +63 -0
- data/lib/inch/language/ruby/provider/yard/object/base.rb +325 -0
- data/lib/inch/language/ruby/provider/yard/object/class_object.rb +14 -0
- data/lib/inch/language/ruby/provider/yard/object/class_variable_object.rb +14 -0
- data/lib/inch/language/ruby/provider/yard/object/constant_object.rb +14 -0
- data/lib/inch/language/ruby/provider/yard/object/method_object.rb +170 -0
- data/lib/inch/language/ruby/provider/yard/object/method_parameter_object.rb +94 -0
- data/lib/inch/language/ruby/provider/yard/object/method_signature.rb +120 -0
- data/lib/inch/language/ruby/provider/yard/object/module_object.rb +14 -0
- data/lib/inch/language/ruby/provider/yard/object/namespace_object.rb +46 -0
- data/lib/inch/language/ruby/provider/yard/object/root_object.rb +14 -0
- data/lib/inch/language/ruby/provider/yard/parser.rb +71 -0
- data/lib/inch/language/ruby/roles/base.rb +17 -0
- data/lib/inch/language/ruby/roles/class_variable.rb +53 -0
- data/lib/inch/language/ruby/roles/constant.rb +53 -0
- data/lib/inch/language/ruby/roles/method.rb +112 -0
- data/lib/inch/language/ruby/roles/method_parameter.rb +84 -0
- data/lib/inch/language/ruby/roles/missing.rb +24 -0
- data/lib/inch/language/ruby/roles/namespace.rb +89 -0
- data/lib/inch/language/ruby/roles/object.rb +120 -0
- data/lib/inch/rake.rb +2 -2
- data/lib/inch/rake/suggest.rb +7 -2
- data/lib/inch/utils/buffered_ui.rb +16 -0
- data/lib/inch/utils/shell_helper.rb +1 -1
- data/lib/inch/utils/ui.rb +5 -5
- data/lib/inch/utils/weighted_list.rb +2 -3
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/{code_examples → ruby/code_examples}/lib/foo.rb +0 -0
- data/test/fixtures/{diff1 → ruby/diff1}/lib/diff1.rb +0 -0
- data/test/fixtures/{diff2 → ruby/diff2}/lib/diff2.rb +0 -0
- data/test/fixtures/{inch-yml → ruby/inch-yml}/.inch.yml +0 -0
- data/test/fixtures/{inch-yml → ruby/inch-yml}/foo/bar.rb +0 -0
- data/test/fixtures/{inch-yml → ruby/inch-yml}/foo/vendor/base.rb +0 -0
- data/test/fixtures/{parameters → ruby/parameters}/lib/foo.rb +0 -0
- data/test/fixtures/{readme → ruby/readme}/lib/foo.rb +0 -0
- data/test/fixtures/{really_good → ruby/really_good}/lib/foo.rb +0 -0
- data/test/fixtures/{really_good_pedantic → ruby/really_good_pedantic}/lib/foo.rb +0 -0
- data/test/fixtures/{simple → ruby/simple}/README +0 -0
- data/test/fixtures/{simple → ruby/simple}/lib/broken.rb +11 -19
- data/test/fixtures/ruby/simple/lib/broken_ruby_2_0_features.rb +7 -0
- data/test/fixtures/ruby/simple/lib/directives.rb +8 -0
- data/test/fixtures/{simple → ruby/simple}/lib/foo.rb +22 -1
- data/test/fixtures/{simple → ruby/simple}/lib/nodoc.rb +0 -0
- data/test/fixtures/{simple → ruby/simple}/lib/role_methods.rb +0 -0
- data/test/fixtures/{simple → ruby/simple}/lib/role_namespaces.rb +0 -0
- data/test/fixtures/{visibility → ruby/visibility}/lib/foo.rb +0 -0
- data/test/fixtures/{yardopts → ruby/yardopts}/.yardopts +0 -0
- data/test/fixtures/{yardopts → ruby/yardopts}/foo/bar.rb +0 -0
- data/test/integration/api/compare/codebases.rb +3 -3
- data/test/integration/cli/command/console_test.rb +6 -6
- data/test/integration/cli/command/diff_test.rb +62 -0
- data/test/integration/cli/command/inspect_test.rb +5 -6
- data/test/integration/cli/command/list_test.rb +4 -5
- data/test/integration/cli/command/show_test.rb +5 -5
- data/test/integration/cli/command/stats_test.rb +3 -3
- data/test/integration/cli/command/suggest_test.rb +13 -13
- data/test/integration/stats_options_test.rb +4 -4
- data/test/integration/visibility_options_test.rb +14 -14
- data/test/shared/base_list.rb +4 -3
- data/test/test_helper.rb +13 -13
- 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 +2 -2
- 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 +3 -3
- data/test/unit/cli/trace_helper_test.rb +1 -1
- data/test/unit/cli/yardopts_helper_test.rb +6 -5
- data/test/unit/code_object/converter_test.rb +1 -1
- data/test/unit/code_object/provider_test.rb +2 -2
- data/test/unit/code_object/proxy_test.rb +2 -2
- data/test/unit/codebase/objects_test.rb +2 -2
- data/test/unit/codebase/proxy_test.rb +7 -5
- data/test/unit/config/codebase_test.rb +4 -4
- data/test/unit/config_test.rb +28 -0
- data/test/unit/evaluation/{role/base_test.rb → role_test.rb} +7 -7
- data/test/unit/{code_object/proxy → language/ruby/code_object}/method_object_test.rb +66 -21
- data/test/unit/{code_object → language/ruby}/provider/yard/docstring_test.rb +74 -38
- data/test/unit/{code_object → language/ruby}/provider/yard/nodoc_helper_test.rb +9 -7
- data/test/unit/{code_object → language/ruby}/provider/yard/object/method_object_test.rb +21 -11
- data/test/unit/language/ruby/provider/yard_test.rb +25 -0
- data/test/unit/utils/buffered_ui_test.rb +48 -0
- data/test/unit/utils/ui_test.rb +7 -7
- data/test/unit/utils/weighted_list_test.rb +7 -4
- metadata +139 -93
- data/lib/inch/code_object/provider/yard.rb +0 -57
- data/lib/inch/code_object/provider/yard/docstring.rb +0 -133
- data/lib/inch/code_object/provider/yard/nodoc_helper.rb +0 -93
- data/lib/inch/code_object/provider/yard/object.rb +0 -60
- data/lib/inch/code_object/provider/yard/object/base.rb +0 -302
- data/lib/inch/code_object/provider/yard/object/class_object.rb +0 -12
- data/lib/inch/code_object/provider/yard/object/class_variable_object.rb +0 -12
- data/lib/inch/code_object/provider/yard/object/constant_object.rb +0 -12
- data/lib/inch/code_object/provider/yard/object/method_object.rb +0 -153
- data/lib/inch/code_object/provider/yard/object/method_parameter_object.rb +0 -88
- data/lib/inch/code_object/provider/yard/object/method_signature.rb +0 -114
- data/lib/inch/code_object/provider/yard/object/module_object.rb +0 -12
- data/lib/inch/code_object/provider/yard/object/namespace_object.rb +0 -47
- data/lib/inch/code_object/provider/yard/object/root_object.rb +0 -12
- data/lib/inch/code_object/provider/yard/parser.rb +0 -62
- data/lib/inch/code_object/proxy/base.rb +0 -241
- data/lib/inch/code_object/proxy/class_object.rb +0 -8
- data/lib/inch/code_object/proxy/class_variable_object.rb +0 -8
- data/lib/inch/code_object/proxy/constant_object.rb +0 -8
- data/lib/inch/code_object/proxy/method_object.rb +0 -82
- data/lib/inch/code_object/proxy/method_parameter_object.rb +0 -60
- data/lib/inch/code_object/proxy/module_object.rb +0 -8
- data/lib/inch/code_object/proxy/namespace_object.rb +0 -33
- data/lib/inch/evaluation/object_schema.rb +0 -30
- data/lib/inch/evaluation/proxy/base.rb +0 -164
- data/lib/inch/evaluation/proxy/class_object.rb +0 -8
- data/lib/inch/evaluation/proxy/class_variable_object.rb +0 -19
- data/lib/inch/evaluation/proxy/constant_object.rb +0 -19
- data/lib/inch/evaluation/proxy/method_object.rb +0 -65
- data/lib/inch/evaluation/proxy/module_object.rb +0 -8
- data/lib/inch/evaluation/proxy/namespace_object.rb +0 -27
- data/lib/inch/evaluation/role/base.rb +0 -92
- data/lib/inch/evaluation/role/class_variable.rb +0 -55
- data/lib/inch/evaluation/role/constant.rb +0 -55
- data/lib/inch/evaluation/role/method.rb +0 -126
- data/lib/inch/evaluation/role/method_parameter.rb +0 -91
- data/lib/inch/evaluation/role/missing.rb +0 -20
- data/lib/inch/evaluation/role/namespace.rb +0 -85
- data/lib/inch/evaluation/role/object.rb +0 -143
- data/test/unit/code_object/provider/yard_test.rb +0 -25
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,11 +1,11 @@
|
|
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::Compare::Codebases do
|
4
4
|
let(:described_class) { ::Inch::API::Compare::Codebases }
|
5
5
|
|
6
6
|
it "should run" do
|
7
|
-
codebase1 = Inch::Codebase.parse fixture_path(:diff1)
|
8
|
-
codebase2 = Inch::Codebase.parse fixture_path(:diff2)
|
7
|
+
codebase1 = Inch::Codebase.parse fixture_path(:ruby, :diff1)
|
8
|
+
codebase2 = Inch::Codebase.parse fixture_path(:ruby, :diff2)
|
9
9
|
|
10
10
|
compare = described_class.new(codebase1, codebase2)
|
11
11
|
refute compare.comparisons.empty?
|
@@ -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
|
class Inch::CLI::Command::Output::Console
|
4
4
|
def run_pry
|
@@ -8,7 +8,7 @@ end
|
|
8
8
|
|
9
9
|
describe ::Inch::CLI::Command::Console do
|
10
10
|
before do
|
11
|
-
Dir.chdir fixture_path(:simple)
|
11
|
+
Dir.chdir fixture_path(:ruby, :simple)
|
12
12
|
@command = ::Inch::CLI::Command::Console
|
13
13
|
end
|
14
14
|
|
@@ -22,8 +22,8 @@ describe ::Inch::CLI::Command::Console do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should run without args" do
|
25
|
-
|
26
|
-
@prompt = @command.new.run
|
25
|
+
_out, _err = capture_io do
|
26
|
+
@prompt = @command.new.run
|
27
27
|
end
|
28
28
|
assert @prompt.respond_to?(:all)
|
29
29
|
assert @prompt.respond_to?(:ff)
|
@@ -34,7 +34,7 @@ describe ::Inch::CLI::Command::Console do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should run with a definitive object name" do
|
37
|
-
|
37
|
+
_out, _err = capture_io do
|
38
38
|
@prompt = @command.new.run("Foo::Bar#method_with_full_doc")
|
39
39
|
end
|
40
40
|
assert !@prompt.all.empty?
|
@@ -46,7 +46,7 @@ describe ::Inch::CLI::Command::Console do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should run with a partial name" do
|
49
|
-
|
49
|
+
_out, _err = capture_io do
|
50
50
|
@prompt = @command.new.run("Foo::Bar#")
|
51
51
|
end
|
52
52
|
assert @prompt.respond_to?(:all)
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")
|
2
|
+
|
3
|
+
require 'tmpdir'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
describe ::Inch::CLI::Command::Diff do
|
7
|
+
before do
|
8
|
+
@command = ::Inch::CLI::Command::Diff
|
9
|
+
@git_url = 'https://github.com/rrrene/sparkr.git'
|
10
|
+
@git_dir = 'sparkr'
|
11
|
+
@git_rev1 = '9da8aeaa64ff21daa1b39e3493134d42d67eb71a'
|
12
|
+
@git_rev2 = 'HEAD'
|
13
|
+
|
14
|
+
@tmp_dir = Dir.mktmpdir
|
15
|
+
# clone the given repo to the tmp_dir
|
16
|
+
Dir.chdir @tmp_dir
|
17
|
+
`git clone #{@git_url} 2>&1`
|
18
|
+
@cloned_dir = File.join(@tmp_dir, @git_dir)
|
19
|
+
Dir.chdir @cloned_dir
|
20
|
+
end
|
21
|
+
|
22
|
+
after do
|
23
|
+
FileUtils.rm_rf @tmp_dir
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should not show any changes" do
|
27
|
+
# this runs `inch diff` on a freshly cloned repo
|
28
|
+
# should not show any changes
|
29
|
+
out, err = capture_io do
|
30
|
+
@command.run
|
31
|
+
end
|
32
|
+
refute out.empty?, "there should be some output"
|
33
|
+
assert err.empty?, "there should be no errors"
|
34
|
+
assert_match /\bno changes\b/i, out
|
35
|
+
|
36
|
+
|
37
|
+
# this runs `inch diff` on two distinct revisions
|
38
|
+
# should show some changes
|
39
|
+
out, err = capture_io do
|
40
|
+
@command.run(@git_rev1, @git_rev2)
|
41
|
+
end
|
42
|
+
refute out.empty?, "there should be some output"
|
43
|
+
assert err.empty?, "there should be no errors"
|
44
|
+
assert_match /\bshowing changes\b/i, out
|
45
|
+
|
46
|
+
|
47
|
+
# we now remove all comments in a single file
|
48
|
+
filename = File.join(@cloned_dir, 'lib/sparkr.rb')
|
49
|
+
content = File.read(filename)
|
50
|
+
content_without_comments = content.gsub(/\s+#(.+)/, '')
|
51
|
+
File.open(filename, 'w') {|f| f.write(content_without_comments) }
|
52
|
+
|
53
|
+
# running the standard `inch diff` again
|
54
|
+
# should now show some changes
|
55
|
+
out, err = capture_io do
|
56
|
+
@command.run
|
57
|
+
end
|
58
|
+
refute out.empty?, "there should be some output"
|
59
|
+
assert err.empty?, "there should be no errors"
|
60
|
+
assert_match /\bshowing changes\b/i, out
|
61
|
+
end
|
62
|
+
end
|
@@ -1,14 +1,14 @@
|
|
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::Inspect do
|
4
4
|
before do
|
5
|
-
Dir.chdir fixture_path(:simple)
|
5
|
+
Dir.chdir fixture_path(:ruby, :simple)
|
6
6
|
@command = ::Inch::CLI::Command::Inspect
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should warn and exit when run without args" do
|
10
10
|
out, err = capture_io do
|
11
|
-
assert_raises(SystemExit) { @command.run
|
11
|
+
assert_raises(SystemExit) { @command.run }
|
12
12
|
end
|
13
13
|
assert out.empty?, "there should be no output"
|
14
14
|
refute err.empty?, "there should be some error message"
|
@@ -33,7 +33,6 @@ describe ::Inch::CLI::Command::Inspect do
|
|
33
33
|
assert err.empty?, "there should be no errors"
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
36
|
it "should output some info when run with a definitive object name" do
|
38
37
|
out, err = capture_io do
|
39
38
|
@command.run("Foo::Qux")
|
@@ -53,14 +52,14 @@ describe ::Inch::CLI::Command::Inspect do
|
|
53
52
|
end
|
54
53
|
|
55
54
|
it "should output colored information" do
|
56
|
-
out,
|
55
|
+
out, _err = capture_io do
|
57
56
|
@command.run("Foo::Bar#")
|
58
57
|
end
|
59
58
|
refute_equal out.uncolor, out, "should be colored"
|
60
59
|
end
|
61
60
|
|
62
61
|
it "should output uncolored information when asked" do
|
63
|
-
out,
|
62
|
+
out, _err = capture_io do
|
64
63
|
@command.run("Foo::Bar#", "--no-color")
|
65
64
|
end
|
66
65
|
assert_equal out.uncolor, out, "should not be colored"
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
2
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../test_helper")
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../shared/base_list")
|
3
3
|
|
4
4
|
describe ::Inch::CLI::Command::List do
|
5
5
|
before do
|
6
|
-
Dir.chdir fixture_path(:simple)
|
6
|
+
Dir.chdir fixture_path(:ruby, :simple)
|
7
7
|
@command = ::Inch::CLI::Command::List
|
8
8
|
end
|
9
9
|
|
@@ -11,7 +11,7 @@ describe ::Inch::CLI::Command::List do
|
|
11
11
|
|
12
12
|
it "should run without args" do
|
13
13
|
out, err = capture_io do
|
14
|
-
@command.run
|
14
|
+
@command.run
|
15
15
|
end
|
16
16
|
refute out.empty?, "there should be some output"
|
17
17
|
assert err.empty?, "there should be no errors"
|
@@ -62,4 +62,3 @@ describe ::Inch::CLI::Command::List do
|
|
62
62
|
assert err.empty?, "there should be no errors"
|
63
63
|
end
|
64
64
|
end
|
65
|
-
|
@@ -1,14 +1,14 @@
|
|
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::Show do
|
4
4
|
before do
|
5
|
-
Dir.chdir fixture_path(:simple)
|
5
|
+
Dir.chdir fixture_path(:ruby, :simple)
|
6
6
|
@command = ::Inch::CLI::Command::Show
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should warn and exit when run without args" do
|
10
10
|
out, err = capture_io do
|
11
|
-
assert_raises(SystemExit) { @command.run
|
11
|
+
assert_raises(SystemExit) { @command.run }
|
12
12
|
end
|
13
13
|
assert out.empty?, "there should be no output"
|
14
14
|
refute err.empty?, "there should be some error message"
|
@@ -44,14 +44,14 @@ describe ::Inch::CLI::Command::Show do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should output colored information" do
|
47
|
-
out,
|
47
|
+
out, _err = capture_io do
|
48
48
|
@command.run("Foo::Bar#")
|
49
49
|
end
|
50
50
|
refute_equal out.uncolor, out, "should be colored"
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should output uncolored information when asked" do
|
54
|
-
out,
|
54
|
+
out, _err = capture_io do
|
55
55
|
@command.run("Foo::Bar#", "--no-color")
|
56
56
|
end
|
57
57
|
assert_equal out.uncolor, out, "should not be colored"
|
@@ -1,14 +1,14 @@
|
|
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::Stats do
|
4
4
|
before do
|
5
|
-
Dir.chdir fixture_path(:simple)
|
5
|
+
Dir.chdir fixture_path(:ruby, :simple)
|
6
6
|
@command = ::Inch::CLI::Command::Stats
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should run without args" do
|
10
10
|
out, err = capture_io do
|
11
|
-
@command.run
|
11
|
+
@command.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,19 +1,19 @@
|
|
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::Suggest do
|
4
4
|
before do
|
5
|
-
Dir.chdir fixture_path(:simple)
|
5
|
+
Dir.chdir fixture_path(:ruby, :simple)
|
6
6
|
@command = ::Inch::CLI::Command::Suggest
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should run without args" do
|
10
10
|
out, err = capture_io do
|
11
|
-
@command.run
|
11
|
+
@command.run
|
12
12
|
end
|
13
13
|
refute out.empty?, "there should be some output"
|
14
14
|
assert err.empty?, "there should be no errors"
|
15
15
|
assert_match /\bFoo::Bar#method_with_wrong_doc\b/, out
|
16
|
-
assert_match /\bFoo::Bar#
|
16
|
+
assert_match /\bFoo::Bar#method_with_rdoc_doc\b/, out
|
17
17
|
assert_match /\bFoo::Bar#method_with_unstructured_doc\b/, out
|
18
18
|
end
|
19
19
|
|
@@ -32,18 +32,18 @@ describe ::Inch::CLI::Command::Suggest do
|
|
32
32
|
refute out.empty?, "there should be some output"
|
33
33
|
assert err.empty?, "there should be no errors"
|
34
34
|
assert_match /\bFoo::Bar#method_with_wrong_doc\b/, out
|
35
|
-
assert_match /\bFoo::Bar#
|
35
|
+
assert_match /\bFoo::Bar#method_with_rdoc_doc\b/, out
|
36
36
|
assert_match /\bFoo::Bar#method_with_unstructured_doc\b/, out
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should run with non-existing filelist in args" do
|
40
|
-
|
40
|
+
_out, _err = capture_io do
|
41
41
|
@command.run("app/**/*.rb")
|
42
42
|
end
|
43
43
|
# TODO: not sure what should actually happen here:
|
44
44
|
# no output or error message?
|
45
|
-
#assert out.empty?, "there should be no output"
|
46
|
-
#assert err.empty?, "there should be no errors"
|
45
|
+
# assert out.empty?, "there should be no output"
|
46
|
+
# assert err.empty?, "there should be no errors"
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should run with --objects switch" do
|
@@ -53,12 +53,12 @@ describe ::Inch::CLI::Command::Suggest do
|
|
53
53
|
refute out.empty?, "there should be some output"
|
54
54
|
assert err.empty?, "there should be no errors"
|
55
55
|
assert_match /\bFoo::Bar#method_with_wrong_doc\b/, out
|
56
|
-
assert_match /\bFoo::Bar#
|
56
|
+
assert_match /\bFoo::Bar#method_with_rdoc_doc\b/, out
|
57
57
|
assert_match /\bFoo::Bar#method_with_unstructured_doc\b/, out
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should give error when run with --unknown-switch" do
|
61
|
-
|
61
|
+
_out, _err = capture_io do
|
62
62
|
assert_raises(SystemExit) { @command.run("--unknown-switch") }
|
63
63
|
end
|
64
64
|
end
|
@@ -85,8 +85,8 @@ describe ::Inch::CLI::Command::Suggest do
|
|
85
85
|
|
86
86
|
it "should run without args on really good fixture" do
|
87
87
|
out, err = capture_io do
|
88
|
-
Dir.chdir fixture_path(:really_good)
|
89
|
-
@command.run
|
88
|
+
Dir.chdir fixture_path(:ruby, :really_good)
|
89
|
+
@command.run
|
90
90
|
end
|
91
91
|
refute out.empty?, "there should be some output"
|
92
92
|
assert err.empty?, "there should be no errors"
|
@@ -94,7 +94,7 @@ describe ::Inch::CLI::Command::Suggest do
|
|
94
94
|
|
95
95
|
it "should run with --pedantic switch" do
|
96
96
|
out, err = capture_io do
|
97
|
-
Dir.chdir fixture_path(:really_good)
|
97
|
+
Dir.chdir fixture_path(:ruby, :really_good)
|
98
98
|
@command.run("--pedantic")
|
99
99
|
end
|
100
100
|
refute out.empty?, "there should be some output"
|
@@ -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.
|
@@ -8,7 +8,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
|
8
8
|
#
|
9
9
|
describe ::Inch::CLI::Command::List do
|
10
10
|
before do
|
11
|
-
Dir.chdir fixture_path(:simple)
|
11
|
+
Dir.chdir fixture_path(:ruby, :simple)
|
12
12
|
@command = "bundle exec inch stats"
|
13
13
|
end
|
14
14
|
|
@@ -20,13 +20,13 @@ describe ::Inch::CLI::Command::List do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should run with --no-private switch" do
|
23
|
-
out =
|
23
|
+
out = `#{@command} --format json`
|
24
24
|
refute out.empty?, "there should be some output"
|
25
25
|
assert_parsed_output JSON[out]
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should run with --no-protected switch" do
|
29
|
-
out =
|
29
|
+
out = `#{@command} --format yaml`
|
30
30
|
refute out.empty?, "there should be some output"
|
31
31
|
assert_parsed_output YAML.load(out)
|
32
32
|
end
|
@@ -1,13 +1,13 @@
|
|
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
|
5
|
-
Dir.chdir fixture_path(:visibility)
|
5
|
+
Dir.chdir fixture_path(:ruby, :visibility)
|
6
6
|
@command = ::Inch::CLI::Command::List
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should run without visibility switches" do
|
10
|
-
out,
|
10
|
+
out, _err = capture_io do
|
11
11
|
@command.run("--all")
|
12
12
|
end
|
13
13
|
refute out.empty?, "there should be some output"
|
@@ -18,7 +18,7 @@ describe ::Inch::CLI::Command do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should run with --no-protected switch" do
|
21
|
-
out,
|
21
|
+
out, _err = capture_io do
|
22
22
|
@command.run("--all", "--no-protected")
|
23
23
|
end
|
24
24
|
refute out.empty?, "there should be some output"
|
@@ -29,8 +29,8 @@ describe ::Inch::CLI::Command do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should run with --no-public switch" do
|
32
|
-
out,
|
33
|
-
@command.run(*%w
|
32
|
+
out, _err = capture_io do
|
33
|
+
@command.run(*%w(--all --no-public))
|
34
34
|
end
|
35
35
|
refute out.empty?, "there should be some output"
|
36
36
|
refute_match /\bFoo#public_method\b/, out
|
@@ -40,8 +40,8 @@ describe ::Inch::CLI::Command do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should run with --no-public --no-protected switch" do
|
43
|
-
out,
|
44
|
-
@command.run(*%w
|
43
|
+
out, _err = capture_io do
|
44
|
+
@command.run(*%w(--all --no-public --no-protected))
|
45
45
|
end
|
46
46
|
assert out.empty?, "there should be no output"
|
47
47
|
refute_match /\bFoo#public_method\b/, out
|
@@ -51,8 +51,8 @@ describe ::Inch::CLI::Command do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should run with --no-public --no-protected --private switch" do
|
54
|
-
out,
|
55
|
-
@command.run(*%w
|
54
|
+
out, _err = capture_io do
|
55
|
+
@command.run(*%w(--all --no-public --no-protected --private))
|
56
56
|
end
|
57
57
|
refute out.empty?, "there should be some output"
|
58
58
|
refute_match /\bFoo#public_method\b/, out
|
@@ -62,8 +62,8 @@ describe ::Inch::CLI::Command do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should run with --no-public switch" do
|
65
|
-
out,
|
66
|
-
@command.run(*%w
|
65
|
+
out, _err = capture_io do
|
66
|
+
@command.run(*%w(--all --no-public))
|
67
67
|
end
|
68
68
|
refute out.empty?, "there should be some output"
|
69
69
|
refute_match /\bFoo#public_method\b/, out
|
@@ -73,8 +73,8 @@ describe ::Inch::CLI::Command do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should run with --no-protected switch" do
|
76
|
-
out,
|
77
|
-
@command.run(*%w
|
76
|
+
out, _err = capture_io do
|
77
|
+
@command.run(*%w(--all --no-protected))
|
78
78
|
end
|
79
79
|
refute out.empty?, "there should be some output"
|
80
80
|
assert_match /\bFoo#public_method\b/, out
|
data/test/shared/base_list.rb
CHANGED
@@ -3,8 +3,10 @@ module Shared
|
|
3
3
|
extend Minitest::Spec::DSL
|
4
4
|
|
5
5
|
it "should give error when run with --unknown-switch" do
|
6
|
-
|
7
|
-
assert_raises(SystemExit)
|
6
|
+
_out, _err = capture_io do
|
7
|
+
assert_raises(SystemExit) do
|
8
|
+
@command.run("lib/foo.rb", "--unknown-switch")
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
@@ -43,7 +45,6 @@ module Shared
|
|
43
45
|
assert_match /\bFoo::Bar#/, out
|
44
46
|
end
|
45
47
|
|
46
|
-
|
47
48
|
it "should run with --only-undocumented switch" do
|
48
49
|
skip
|
49
50
|
out, err = capture_io do
|