rcodetools 0.8.0.0 → 0.8.1.0
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.
- data/Rakefile +3 -3
- data/bin/rct-complete +1 -1
- data/bin/rct-doc +1 -1
- data/bin/rct-meth-args +1 -1
- data/bin/xmpfilter +1 -1
- data/lib/rcodetools/xmpfilter.rb +2 -2
- data/rcodetools.elc +0 -0
- data/rcodetools.gif +0 -0
- data/rcodetools.sxmp +0 -0
- data/test/attic/test_run.rb +45 -0
- data/test/data/attic/add_markers-input.rb +2 -0
- data/test/data/attic/add_markers-output.rb +2 -0
- data/test/data/attic/bindings-input.rb +26 -0
- data/test/data/attic/bindings-output.rb +31 -0
- data/test/data/attic/completion-input.rb +1 -0
- data/test/data/attic/completion-output.rb +2 -0
- data/test/data/attic/completion_class_info-input.rb +1 -0
- data/test/data/attic/completion_class_info-output.rb +10 -0
- data/test/data/attic/completion_class_info_no_candidates-input.rb +1 -0
- data/test/data/attic/completion_class_info_no_candidates-output.rb +1 -0
- data/test/data/attic/completion_detect_rbtest-input.rb +7 -0
- data/test/data/attic/completion_detect_rbtest-output.rb +2 -0
- data/test/data/attic/completion_detect_rbtest2-input.rb +1 -0
- data/test/data/attic/completion_detect_rbtest2-output.rb +2 -0
- data/test/data/attic/completion_emacs-input.rb +1 -0
- data/test/data/attic/completion_emacs-output.rb +6 -0
- data/test/data/attic/completion_emacs_icicles-input.rb +1 -0
- data/test/data/attic/completion_emacs_icicles-output.rb +6 -0
- data/test/data/attic/completion_in_method-input.rb +3 -0
- data/test/data/attic/completion_in_method-output.rb +1 -0
- data/test/data/attic/completion_in_method-test.rb +6 -0
- data/test/data/attic/completion_rbtest-input.rb +7 -0
- data/test/data/attic/completion_rbtest-output.rb +2 -0
- data/test/data/attic/doc-input.rb +1 -0
- data/test/data/attic/doc-output.rb +1 -0
- data/test/data/attic/doc_detect_rbtest-input.rb +1 -0
- data/test/data/attic/doc_detect_rbtest-output.rb +1 -0
- data/test/data/attic/doc_detect_rbtest2-input.rb +7 -0
- data/test/data/attic/doc_detect_rbtest2-output.rb +1 -0
- data/test/data/attic/doc_rbtest-input.rb +7 -0
- data/test/data/attic/doc_rbtest-output.rb +1 -0
- data/test/data/attic/no_warnings-input.rb +3 -0
- data/test/data/attic/no_warnings-output.rb +4 -0
- data/test/data/attic/refe-input.rb +1 -0
- data/test/data/attic/refe-output.rb +1 -0
- data/test/data/attic/ri-input.rb +1 -0
- data/test/data/attic/ri-output.rb +1 -0
- data/test/data/attic/ri_emacs-input.rb +1 -0
- data/test/data/attic/ri_emacs-output.rb +1 -0
- data/test/data/attic/ri_vim-input.rb +1 -0
- data/test/data/attic/ri_vim-output.rb +1 -0
- data/test/data/attic/rspec-input.rb +48 -0
- data/test/data/attic/rspec-output.rb +52 -0
- data/test/data/attic/rspec_poetry-input.rb +48 -0
- data/test/data/attic/rspec_poetry-output.rb +52 -0
- data/test/data/attic/simple_annotation-input.rb +8 -0
- data/test/data/attic/simple_annotation-output.rb +8 -0
- data/test/data/attic/unit_test-input.rb +50 -0
- data/test/data/attic/unit_test-output.rb +52 -0
- data/test/data/attic/unit_test_detect_rbtest-input.rb +50 -0
- data/test/data/attic/unit_test_detect_rbtest-output.rb +52 -0
- data/test/data/attic/unit_test_detect_rbtest2-input.rb +6 -0
- data/test/data/attic/unit_test_detect_rbtest2-output.rb +6 -0
- data/test/data/attic/unit_test_poetry-input.rb +50 -0
- data/test/data/attic/unit_test_poetry-output.rb +52 -0
- data/test/data/attic/unit_test_rbtest-input.rb +6 -0
- data/test/data/attic/unit_test_rbtest-output.rb +6 -0
- data/test/data/rct-complete-TDC/completion_in_method__testmethod.taf +17 -0
- data/test/data/rct-complete-TDC/completion_in_method__testscript.taf +17 -0
- data/test/data/rct-complete-TDC/completion_in_method__wrong_testmethod.taf +17 -0
- data/test/data/rct-complete/completion.taf +9 -0
- data/test/data/rct-complete/completion_class_info.taf +9 -0
- data/test/data/rct-complete/completion_class_info_no_candidates.taf +8 -0
- data/test/data/rct-complete/completion_detect_rbtest.taf +15 -0
- data/test/data/rct-complete/completion_detect_rbtest2.taf +9 -0
- data/test/data/rct-complete/completion_emacs.taf +13 -0
- data/test/data/rct-complete/completion_emacs_icicles.taf +13 -0
- data/test/data/rct-complete/completion_rbtest.taf +15 -0
- data/test/data/rct-doc/doc.taf +8 -0
- data/test/data/rct-doc/doc_detect_rbtest.taf +8 -0
- data/test/data/rct-doc/doc_detect_rbtest2.taf +14 -0
- data/test/data/rct-doc/doc_rbtest.taf +14 -0
- data/test/data/rct-doc/refe.taf +8 -0
- data/test/data/rct-doc/ri.taf +8 -0
- data/test/data/rct-doc/ri_emacs.taf +8 -0
- data/test/data/rct-doc/ri_vim.taf +8 -0
- data/test/data/xmpfilter/add_markers.taf +10 -0
- data/test/data/xmpfilter/bindings.taf +63 -0
- data/test/data/xmpfilter/comment_out.taf +22 -0
- data/test/data/xmpfilter/exception.taf +14 -0
- data/test/data/xmpfilter/expectations.taf +54 -0
- data/test/data/xmpfilter/last_match.taf +18 -0
- data/test/data/xmpfilter/mult.rb +9 -0
- data/test/data/xmpfilter/multi_line_annotation_1.taf +22 -0
- data/test/data/xmpfilter/multi_line_annotation_2.taf +24 -0
- data/test/data/xmpfilter/multi_line_annotation_3.taf +20 -0
- data/test/data/xmpfilter/multi_line_annotation_4.taf +22 -0
- data/test/data/xmpfilter/multi_line_annotation_5.taf +34 -0
- data/test/data/xmpfilter/no_warnings.taf +13 -0
- data/test/data/xmpfilter/nospace.taf +16 -0
- data/test/data/xmpfilter/rspec.taf +106 -0
- data/test/data/xmpfilter/rspec_poetry.taf +106 -0
- data/test/data/xmpfilter/simple_annotation.taf +22 -0
- data/test/data/xmpfilter/unit_test.taf +108 -0
- data/test/data/xmpfilter/unit_test_detect_rbtest.taf +108 -0
- data/test/data/xmpfilter/unit_test_detect_rbtest2.taf +18 -0
- data/test/data/xmpfilter/unit_test_poetry.taf +108 -0
- data/test/data/xmpfilter/unit_test_rbtest.taf +18 -0
- data/test/data/xmpfilter/width.taf +16 -0
- data/test/tmp_functional.rb +162 -0
- data/test/tmp_run.rb +66 -0
- metadata +127 -22
data/Rakefile
CHANGED
|
@@ -40,7 +40,7 @@ PKG_FILES = FileList[
|
|
|
40
40
|
"README", "README.*", "THANKS",
|
|
41
41
|
"Rakefile", "Rakefile.method_analysis",
|
|
42
42
|
"setup.rb",
|
|
43
|
-
"test/**/*.rb",
|
|
43
|
+
"test/**/*.rb","test/**/*.taf"
|
|
44
44
|
]
|
|
45
45
|
|
|
46
46
|
begin
|
|
@@ -92,9 +92,9 @@ EOF
|
|
|
92
92
|
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
task :gem
|
|
95
|
+
task :gem => [:test]
|
|
96
96
|
Rake::GemPackageTask.new(Spec) do |p|
|
|
97
|
-
|
|
97
|
+
p.need_tar_gz = true
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
rescue LoadError
|
data/bin/rct-complete
CHANGED
data/bin/rct-doc
CHANGED
data/bin/rct-meth-args
CHANGED
data/bin/xmpfilter
CHANGED
data/lib/rcodetools/xmpfilter.rb
CHANGED
|
@@ -11,7 +11,7 @@ require 'tmpdir'
|
|
|
11
11
|
module Rcodetools
|
|
12
12
|
|
|
13
13
|
class XMPFilter
|
|
14
|
-
VERSION = "0.8.
|
|
14
|
+
VERSION = "0.8.1"
|
|
15
15
|
|
|
16
16
|
MARKER = "!XMP#{Time.new.to_i}_#{Process.pid}_#{rand(1000000)}!"
|
|
17
17
|
XMP_RE = Regexp.new("^" + Regexp.escape(MARKER) + '\[([0-9]+)\] (=>|~>|==>) (.*)')
|
|
@@ -225,7 +225,7 @@ end || #{v}
|
|
|
225
225
|
exe_line = <<-EOF.map{|l| l.strip}.join(";")
|
|
226
226
|
$stdout.reopen('#{File.expand_path(stdout.path)}', 'w')
|
|
227
227
|
$stderr.reopen('#{File.expand_path(stderr.path)}', 'w')
|
|
228
|
-
$0
|
|
228
|
+
$0 = '#{File.expand_path(stdin.path)}'
|
|
229
229
|
ARGV.replace(#{@options.inspect})
|
|
230
230
|
load #{File.expand_path(stdin.path).inspect}
|
|
231
231
|
#{@evals.join(";")}
|
data/rcodetools.elc
ADDED
|
Binary file
|
data/rcodetools.gif
ADDED
|
Binary file
|
data/rcodetools.sxmp
ADDED
|
Binary file
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'test/unit'
|
|
2
|
+
require 'rcodetools/xmpfilter'
|
|
3
|
+
require 'rcodetools/xmptestunitfilter'
|
|
4
|
+
require 'rcodetools/completion'
|
|
5
|
+
require 'rcodetools/doc'
|
|
6
|
+
require 'rcodetools/options'
|
|
7
|
+
require 'stringio'
|
|
8
|
+
|
|
9
|
+
class TestRun < Test::Unit::TestCase
|
|
10
|
+
include Rcodetools
|
|
11
|
+
DIR = File.expand_path(File.dirname(__FILE__))
|
|
12
|
+
|
|
13
|
+
tests = {
|
|
14
|
+
:simple_annotation => {:klass => XMPFilter},
|
|
15
|
+
:unit_test => {:klass => XMPTestUnitFilter},
|
|
16
|
+
:rspec => {:klass => XMPRSpecFilter, :interpreter => "spec"},
|
|
17
|
+
:rspec_poetry => {:klass => XMPRSpecFilter, :interpreter => "spec", :use_parentheses => false},
|
|
18
|
+
:no_warnings => {:klass => XMPFilter, :warnings => false},
|
|
19
|
+
:bindings => {:klass => XMPTestUnitFilter, :use_parentheses => false},
|
|
20
|
+
:unit_test_poetry => {:klass => XMPTestUnitFilter, :use_parentheses => false},
|
|
21
|
+
:add_markers => {:klass => XMPAddMarkers},
|
|
22
|
+
|
|
23
|
+
:completion => {:klass => XMPCompletionFilter, :lineno => 1},
|
|
24
|
+
:completion_emacs => {:klass => XMPCompletionEmacsFilter, :lineno => 1},
|
|
25
|
+
:completion_emacs_icicles => {:klass => XMPCompletionEmacsIciclesFilter, :lineno => 1},
|
|
26
|
+
:completion_class_info => {:klass => XMPCompletionClassInfoFilter, :lineno => 1},
|
|
27
|
+
:completion_class_info_no_candidates => {:klass => XMPCompletionClassInfoFilter, :lineno => 1},
|
|
28
|
+
|
|
29
|
+
:doc => {:klass => XMPDocFilter, :lineno => 1},
|
|
30
|
+
:refe => {:klass => XMPReFeFilter, :lineno => 1},
|
|
31
|
+
:ri => {:klass => XMPRiFilter, :lineno => 1},
|
|
32
|
+
:ri_emacs => {:klass => XMPRiEmacsFilter, :lineno => 1},
|
|
33
|
+
:ri_vim => {:klass => XMPRiVimFilter, :lineno => 1},
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
tests.each_pair do |test, opts|
|
|
37
|
+
define_method("test_#{test}") do
|
|
38
|
+
inputfile = "#{DIR}/data/#{test}-input.rb"
|
|
39
|
+
outputfile = "#{DIR}/data/#{test}-output.rb"
|
|
40
|
+
sio = StringIO.new
|
|
41
|
+
sio.puts opts[:klass].run(File.read(inputfile), DEFAULT_OPTIONS.merge(opts))
|
|
42
|
+
assert_equal(File.read(outputfile), sio.string)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
require 'test/unit'
|
|
3
|
+
|
|
4
|
+
class TestFoo < Test::Unit::TestCase
|
|
5
|
+
def setup
|
|
6
|
+
@o = []
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def test_foo
|
|
10
|
+
a = 1
|
|
11
|
+
b = a
|
|
12
|
+
b # =>
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def test_arr
|
|
16
|
+
last = 1
|
|
17
|
+
@o << last
|
|
18
|
+
@o.last # =>
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_bar
|
|
22
|
+
a = b = c = 1
|
|
23
|
+
d = a
|
|
24
|
+
d # =>
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
require 'test/unit'
|
|
3
|
+
|
|
4
|
+
class TestFoo < Test::Unit::TestCase
|
|
5
|
+
def setup
|
|
6
|
+
@o = []
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def test_foo
|
|
10
|
+
a = 1
|
|
11
|
+
b = a
|
|
12
|
+
assert_equal a, b
|
|
13
|
+
assert_equal 1, b
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_arr
|
|
17
|
+
last = 1
|
|
18
|
+
@o << last
|
|
19
|
+
assert_equal last, @o.last
|
|
20
|
+
assert_equal 1, @o.last
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_bar
|
|
24
|
+
a = b = c = 1
|
|
25
|
+
d = a
|
|
26
|
+
assert_equal a, d
|
|
27
|
+
assert_equal b, d
|
|
28
|
+
assert_equal c, d
|
|
29
|
+
assert_equal 1, d
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Array.new(3).uni
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Array.new(3).s
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Array.new(3).nonexisten
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Array.new(3).uni
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Array.new(3).uni
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.div
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
length
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[].length
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Array#length
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[].length
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Array#length
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
String#upcase
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
String#upcase
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[].length
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
refe 'Array#length'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[].length
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ri 'Array#length'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[].length
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(rct-find-tag-or-ri "Array#length")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[].length
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
call RCT_find_tag_or_ri("Array#length")
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
class X
|
|
3
|
+
Y = Struct.new(:a)
|
|
4
|
+
def foo(b); b ? Y.new(2) : 2 end
|
|
5
|
+
def bar; raise "No good" end
|
|
6
|
+
def baz; nil end
|
|
7
|
+
def fubar(x); x ** 2.0 + 1 end
|
|
8
|
+
def babar; [1,2] end
|
|
9
|
+
A = 1
|
|
10
|
+
A = 1
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
describe "xmpfilter's expectation expansion" do
|
|
15
|
+
before do
|
|
16
|
+
@o = X.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should expand should == expectations" do
|
|
20
|
+
@o.foo(true) # =>
|
|
21
|
+
@o.foo(true).a # =>
|
|
22
|
+
@o.foo(false) # =>
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should expand should raise_error expectations" do
|
|
26
|
+
@o.bar # =>
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should expand should be_nil expectations" do
|
|
30
|
+
@o.baz # =>
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "should expand correct expectations for complex values" do
|
|
34
|
+
@o.babar # =>
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "should expand should be_close expectations" do
|
|
38
|
+
@o.fubar(10) # =>
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe "xmpfilter's automagic binding detection" do
|
|
43
|
+
it "should expand should == expectations" do
|
|
44
|
+
a = b = c = 1
|
|
45
|
+
d = a
|
|
46
|
+
d # =>
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
class X
|
|
3
|
+
Y = Struct.new(:a)
|
|
4
|
+
def foo(b); b ? Y.new(2) : 2 end
|
|
5
|
+
def bar; raise "No good" end
|
|
6
|
+
def baz; nil end
|
|
7
|
+
def fubar(x); x ** 2.0 + 1 end
|
|
8
|
+
def babar; [1,2] end
|
|
9
|
+
A = 1
|
|
10
|
+
A = 1 # !> already initialized constant A
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
describe "xmpfilter's expectation expansion" do
|
|
15
|
+
before do
|
|
16
|
+
@o = X.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should expand should == expectations" do
|
|
20
|
+
(@o.foo(true)).should be_a_kind_of(X::Y)
|
|
21
|
+
(@o.foo(true).inspect).should == ("#<struct X::Y a=2>")
|
|
22
|
+
(@o.foo(true).a).should == (2)
|
|
23
|
+
(@o.foo(false)).should == (2)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should expand should raise_error expectations" do
|
|
27
|
+
lambda{@o.bar}.should raise_error(RuntimeError)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should expand should be_nil expectations" do
|
|
31
|
+
(@o.baz).should be_nil
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should expand correct expectations for complex values" do
|
|
35
|
+
(@o.babar).should == ([1, 2])
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should expand should be_close expectations" do
|
|
39
|
+
(@o.fubar(10)).should be_close(101.0, 0.0001)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe "xmpfilter's automagic binding detection" do
|
|
44
|
+
it "should expand should == expectations" do
|
|
45
|
+
a = b = c = 1
|
|
46
|
+
d = a
|
|
47
|
+
(d).should == (a)
|
|
48
|
+
(d).should == (b)
|
|
49
|
+
(d).should == (c)
|
|
50
|
+
(d).should == (1)
|
|
51
|
+
end
|
|
52
|
+
end
|