rcodetools 0.8.0.0 → 0.8.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/Rakefile +3 -3
  2. data/bin/rct-complete +1 -1
  3. data/bin/rct-doc +1 -1
  4. data/bin/rct-meth-args +1 -1
  5. data/bin/xmpfilter +1 -1
  6. data/lib/rcodetools/xmpfilter.rb +2 -2
  7. data/rcodetools.elc +0 -0
  8. data/rcodetools.gif +0 -0
  9. data/rcodetools.sxmp +0 -0
  10. data/test/attic/test_run.rb +45 -0
  11. data/test/data/attic/add_markers-input.rb +2 -0
  12. data/test/data/attic/add_markers-output.rb +2 -0
  13. data/test/data/attic/bindings-input.rb +26 -0
  14. data/test/data/attic/bindings-output.rb +31 -0
  15. data/test/data/attic/completion-input.rb +1 -0
  16. data/test/data/attic/completion-output.rb +2 -0
  17. data/test/data/attic/completion_class_info-input.rb +1 -0
  18. data/test/data/attic/completion_class_info-output.rb +10 -0
  19. data/test/data/attic/completion_class_info_no_candidates-input.rb +1 -0
  20. data/test/data/attic/completion_class_info_no_candidates-output.rb +1 -0
  21. data/test/data/attic/completion_detect_rbtest-input.rb +7 -0
  22. data/test/data/attic/completion_detect_rbtest-output.rb +2 -0
  23. data/test/data/attic/completion_detect_rbtest2-input.rb +1 -0
  24. data/test/data/attic/completion_detect_rbtest2-output.rb +2 -0
  25. data/test/data/attic/completion_emacs-input.rb +1 -0
  26. data/test/data/attic/completion_emacs-output.rb +6 -0
  27. data/test/data/attic/completion_emacs_icicles-input.rb +1 -0
  28. data/test/data/attic/completion_emacs_icicles-output.rb +6 -0
  29. data/test/data/attic/completion_in_method-input.rb +3 -0
  30. data/test/data/attic/completion_in_method-output.rb +1 -0
  31. data/test/data/attic/completion_in_method-test.rb +6 -0
  32. data/test/data/attic/completion_rbtest-input.rb +7 -0
  33. data/test/data/attic/completion_rbtest-output.rb +2 -0
  34. data/test/data/attic/doc-input.rb +1 -0
  35. data/test/data/attic/doc-output.rb +1 -0
  36. data/test/data/attic/doc_detect_rbtest-input.rb +1 -0
  37. data/test/data/attic/doc_detect_rbtest-output.rb +1 -0
  38. data/test/data/attic/doc_detect_rbtest2-input.rb +7 -0
  39. data/test/data/attic/doc_detect_rbtest2-output.rb +1 -0
  40. data/test/data/attic/doc_rbtest-input.rb +7 -0
  41. data/test/data/attic/doc_rbtest-output.rb +1 -0
  42. data/test/data/attic/no_warnings-input.rb +3 -0
  43. data/test/data/attic/no_warnings-output.rb +4 -0
  44. data/test/data/attic/refe-input.rb +1 -0
  45. data/test/data/attic/refe-output.rb +1 -0
  46. data/test/data/attic/ri-input.rb +1 -0
  47. data/test/data/attic/ri-output.rb +1 -0
  48. data/test/data/attic/ri_emacs-input.rb +1 -0
  49. data/test/data/attic/ri_emacs-output.rb +1 -0
  50. data/test/data/attic/ri_vim-input.rb +1 -0
  51. data/test/data/attic/ri_vim-output.rb +1 -0
  52. data/test/data/attic/rspec-input.rb +48 -0
  53. data/test/data/attic/rspec-output.rb +52 -0
  54. data/test/data/attic/rspec_poetry-input.rb +48 -0
  55. data/test/data/attic/rspec_poetry-output.rb +52 -0
  56. data/test/data/attic/simple_annotation-input.rb +8 -0
  57. data/test/data/attic/simple_annotation-output.rb +8 -0
  58. data/test/data/attic/unit_test-input.rb +50 -0
  59. data/test/data/attic/unit_test-output.rb +52 -0
  60. data/test/data/attic/unit_test_detect_rbtest-input.rb +50 -0
  61. data/test/data/attic/unit_test_detect_rbtest-output.rb +52 -0
  62. data/test/data/attic/unit_test_detect_rbtest2-input.rb +6 -0
  63. data/test/data/attic/unit_test_detect_rbtest2-output.rb +6 -0
  64. data/test/data/attic/unit_test_poetry-input.rb +50 -0
  65. data/test/data/attic/unit_test_poetry-output.rb +52 -0
  66. data/test/data/attic/unit_test_rbtest-input.rb +6 -0
  67. data/test/data/attic/unit_test_rbtest-output.rb +6 -0
  68. data/test/data/rct-complete-TDC/completion_in_method__testmethod.taf +17 -0
  69. data/test/data/rct-complete-TDC/completion_in_method__testscript.taf +17 -0
  70. data/test/data/rct-complete-TDC/completion_in_method__wrong_testmethod.taf +17 -0
  71. data/test/data/rct-complete/completion.taf +9 -0
  72. data/test/data/rct-complete/completion_class_info.taf +9 -0
  73. data/test/data/rct-complete/completion_class_info_no_candidates.taf +8 -0
  74. data/test/data/rct-complete/completion_detect_rbtest.taf +15 -0
  75. data/test/data/rct-complete/completion_detect_rbtest2.taf +9 -0
  76. data/test/data/rct-complete/completion_emacs.taf +13 -0
  77. data/test/data/rct-complete/completion_emacs_icicles.taf +13 -0
  78. data/test/data/rct-complete/completion_rbtest.taf +15 -0
  79. data/test/data/rct-doc/doc.taf +8 -0
  80. data/test/data/rct-doc/doc_detect_rbtest.taf +8 -0
  81. data/test/data/rct-doc/doc_detect_rbtest2.taf +14 -0
  82. data/test/data/rct-doc/doc_rbtest.taf +14 -0
  83. data/test/data/rct-doc/refe.taf +8 -0
  84. data/test/data/rct-doc/ri.taf +8 -0
  85. data/test/data/rct-doc/ri_emacs.taf +8 -0
  86. data/test/data/rct-doc/ri_vim.taf +8 -0
  87. data/test/data/xmpfilter/add_markers.taf +10 -0
  88. data/test/data/xmpfilter/bindings.taf +63 -0
  89. data/test/data/xmpfilter/comment_out.taf +22 -0
  90. data/test/data/xmpfilter/exception.taf +14 -0
  91. data/test/data/xmpfilter/expectations.taf +54 -0
  92. data/test/data/xmpfilter/last_match.taf +18 -0
  93. data/test/data/xmpfilter/mult.rb +9 -0
  94. data/test/data/xmpfilter/multi_line_annotation_1.taf +22 -0
  95. data/test/data/xmpfilter/multi_line_annotation_2.taf +24 -0
  96. data/test/data/xmpfilter/multi_line_annotation_3.taf +20 -0
  97. data/test/data/xmpfilter/multi_line_annotation_4.taf +22 -0
  98. data/test/data/xmpfilter/multi_line_annotation_5.taf +34 -0
  99. data/test/data/xmpfilter/no_warnings.taf +13 -0
  100. data/test/data/xmpfilter/nospace.taf +16 -0
  101. data/test/data/xmpfilter/rspec.taf +106 -0
  102. data/test/data/xmpfilter/rspec_poetry.taf +106 -0
  103. data/test/data/xmpfilter/simple_annotation.taf +22 -0
  104. data/test/data/xmpfilter/unit_test.taf +108 -0
  105. data/test/data/xmpfilter/unit_test_detect_rbtest.taf +108 -0
  106. data/test/data/xmpfilter/unit_test_detect_rbtest2.taf +18 -0
  107. data/test/data/xmpfilter/unit_test_poetry.taf +108 -0
  108. data/test/data/xmpfilter/unit_test_rbtest.taf +18 -0
  109. data/test/data/xmpfilter/width.taf +16 -0
  110. data/test/tmp_functional.rb +162 -0
  111. data/test/tmp_run.rb +66 -0
  112. metadata +127 -22
@@ -0,0 +1,108 @@
1
+ ==========
2
+ unit_test_detect_rbtest
3
+ ==========
4
+ xmpfilter -u --detect-rbtest
5
+ ==========
6
+
7
+ class X
8
+ Y = Struct.new(:a)
9
+ def foo(b); b ? Y.new(2) : 2 end
10
+ def bar; raise "No good" end
11
+ def baz; nil end
12
+ def fubar(x); x ** 2.0 + 1 end
13
+ def babar; [1,2] end
14
+ A = 1
15
+ A = 1
16
+ def difftype() [1, "s"] end
17
+ end
18
+
19
+
20
+ require 'test/unit'
21
+ class Test_X < Test::Unit::TestCase
22
+ def setup
23
+ @o = X.new
24
+ end
25
+
26
+ def test_foo
27
+ @o.foo(true) # =>
28
+ @o.foo(true).a # =>
29
+ @o.foo(false) # =>
30
+ end
31
+
32
+ def test_bar
33
+ @o.bar # =>
34
+ end
35
+
36
+ def test_baz
37
+ @o.baz # =>
38
+ end
39
+
40
+ def test_babar
41
+ @o.babar # =>
42
+ end
43
+
44
+ def test_fubar
45
+ @o.fubar(10) # =>
46
+ end
47
+
48
+ def test_difftype
49
+ for x in @o.difftype
50
+ x # =>
51
+ end
52
+ end
53
+
54
+ end
55
+
56
+ ==========
57
+
58
+ class X
59
+ Y = Struct.new(:a)
60
+ def foo(b); b ? Y.new(2) : 2 end
61
+ def bar; raise "No good" end
62
+ def baz; nil end
63
+ def fubar(x); x ** 2.0 + 1 end
64
+ def babar; [1,2] end
65
+ A = 1
66
+ A = 1 # !> already initialized constant A
67
+ def difftype() [1, "s"] end
68
+ end
69
+
70
+
71
+ require 'test/unit'
72
+ class Test_X < Test::Unit::TestCase
73
+ def setup
74
+ @o = X.new
75
+ end
76
+
77
+ def test_foo
78
+ assert_kind_of(X::Y, @o.foo(true))
79
+ assert_equal("#<struct X::Y a=2>", @o.foo(true).inspect)
80
+ assert_equal(2, @o.foo(true).a)
81
+ assert_equal(2, @o.foo(false))
82
+ end
83
+
84
+ def test_bar
85
+ assert_raise(RuntimeError){@o.bar}
86
+ end
87
+
88
+ def test_baz
89
+ assert_nil(@o.baz)
90
+ end
91
+
92
+ def test_babar
93
+ assert_equal([1, 2], @o.babar)
94
+ end
95
+
96
+ def test_fubar
97
+ assert_in_delta(101.0, @o.fubar(10), 0.0001)
98
+ end
99
+
100
+ def test_difftype
101
+ for x in @o.difftype
102
+ #xmpfilter: WARNING!! extra values ignored
103
+ assert_equal(1, x)
104
+ end
105
+ end
106
+
107
+ end
108
+
@@ -0,0 +1,18 @@
1
+ ==========
2
+ unit_test_detect_rbtest2
3
+ ==========
4
+ xmpfilter --detect-rbtest
5
+ ==========
6
+ =begin test_bar
7
+ bar("bar") # =>
8
+ =end
9
+ def bar(s)
10
+ s.upcase
11
+ end
12
+ ==========
13
+ =begin test_bar
14
+ assert_equal("BAR", bar("bar"))
15
+ =end
16
+ def bar(s)
17
+ s.upcase
18
+ end
@@ -0,0 +1,108 @@
1
+ ==========
2
+ unit_test_poetry
3
+ ==========
4
+ xmpfilter -u --poetry
5
+ ==========
6
+
7
+ class X
8
+ Y = Struct.new(:a)
9
+ def foo(b); b ? Y.new(2) : 2 end
10
+ def bar; raise "No good" end
11
+ def baz; nil end
12
+ def fubar(x); x ** 2.0 + 1 end
13
+ def babar; [1,2] end
14
+ A = 1
15
+ A = 1
16
+ def difftype() [1, "s"] end
17
+ end
18
+
19
+
20
+ require 'test/unit'
21
+ class Test_X < Test::Unit::TestCase
22
+ def setup
23
+ @o = X.new
24
+ end
25
+
26
+ def test_foo
27
+ @o.foo(true) # =>
28
+ @o.foo(true).a # =>
29
+ @o.foo(false) # =>
30
+ end
31
+
32
+ def test_bar
33
+ @o.bar # =>
34
+ end
35
+
36
+ def test_baz
37
+ @o.baz # =>
38
+ end
39
+
40
+ def test_babar
41
+ @o.babar # =>
42
+ end
43
+
44
+ def test_fubar
45
+ @o.fubar(10) # =>
46
+ end
47
+
48
+ def test_difftype
49
+ for x in @o.difftype
50
+ x # =>
51
+ end
52
+ end
53
+
54
+ end
55
+
56
+ ==========
57
+
58
+ class X
59
+ Y = Struct.new(:a)
60
+ def foo(b); b ? Y.new(2) : 2 end
61
+ def bar; raise "No good" end
62
+ def baz; nil end
63
+ def fubar(x); x ** 2.0 + 1 end
64
+ def babar; [1,2] end
65
+ A = 1
66
+ A = 1 # !> already initialized constant A
67
+ def difftype() [1, "s"] end
68
+ end
69
+
70
+
71
+ require 'test/unit'
72
+ class Test_X < Test::Unit::TestCase
73
+ def setup
74
+ @o = X.new
75
+ end
76
+
77
+ def test_foo
78
+ assert_kind_of X::Y, @o.foo(true)
79
+ assert_equal "#<struct X::Y a=2>", @o.foo(true).inspect
80
+ assert_equal 2, @o.foo(true).a
81
+ assert_equal 2, @o.foo(false)
82
+ end
83
+
84
+ def test_bar
85
+ assert_raise(RuntimeError){@o.bar}
86
+ end
87
+
88
+ def test_baz
89
+ assert_nil @o.baz
90
+ end
91
+
92
+ def test_babar
93
+ assert_equal [1, 2], @o.babar
94
+ end
95
+
96
+ def test_fubar
97
+ assert_in_delta 101.0, @o.fubar(10), 0.0001
98
+ end
99
+
100
+ def test_difftype
101
+ for x in @o.difftype
102
+ #xmpfilter: WARNING!! extra values ignored
103
+ assert_equal 1, x
104
+ end
105
+ end
106
+
107
+ end
108
+
@@ -0,0 +1,18 @@
1
+ ==========
2
+ unit_test_rbtest
3
+ ==========
4
+ xmpfilter -u --rbtest
5
+ ==========
6
+ =begin test_bar
7
+ bar("bar") # =>
8
+ =end
9
+ def bar(s)
10
+ s.upcase
11
+ end
12
+ ==========
13
+ =begin test_bar
14
+ assert_equal("BAR", bar("bar"))
15
+ =end
16
+ def bar(s)
17
+ s.upcase
18
+ end
@@ -0,0 +1,16 @@
1
+ ==========
2
+ width
3
+ ==========
4
+ xmpfilter -w 15
5
+ ==========
6
+
7
+ a = ["abcdefg", 12345, Object]
8
+ a
9
+ # =>
10
+ ==========
11
+
12
+ a = ["abcdefg", 12345, Object]
13
+ a
14
+ # => ["abcdefg",
15
+ # 12345,
16
+ # Object]
@@ -0,0 +1,162 @@
1
+ require 'test/unit'
2
+
3
+ module TestFunctional
4
+ DIR = File.expand_path(File.dirname(__FILE__))
5
+ LIBDIR = File.expand_path(DIR + '/../lib')
6
+
7
+ module DefineFunctionalTests
8
+ def define_functional_tests(bin, exec, tests)
9
+ tests.each_pair do |test, opts|
10
+ define_method("test_#{test}") do
11
+
12
+ output = `ruby -I#{LIBDIR} #{exec} #{opts.join(" ")} #{DIR}/data/#{test}-input.rb`
13
+ outputfile = "#{DIR}/data/#{test}-output.rb"
14
+ taffile = "#{DIR}/data/#{bin}/#{test}.taf"
15
+ open(taffile, "w") do |f|
16
+ f.puts "=========="
17
+ f.puts test
18
+ f.puts "=========="
19
+ f.puts bin + " " + opts.join(" ")
20
+ f.puts "=========="
21
+ f.puts File.read("#{DIR}/data/#{test}-input.rb")
22
+ f.puts "=========="
23
+ f.puts File.read("#{DIR}/data/#{test}-output.rb")
24
+ end
25
+ # assert_equal(File.read(outputfile), output)
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ class TestXmpfilter < Test::Unit::TestCase
32
+ extend DefineFunctionalTests
33
+ tests = {
34
+ :simple_annotation => [], :unit_test => ["-u"], :rspec => ["-s"],
35
+ :no_warnings => ["--no-warnings"], :bindings => ["--poetry", "-u"],
36
+ :add_markers => ["-m"], :unit_test_rbtest => ["-u", "--rbtest"],
37
+ :unit_test_detect_rbtest => ["-u", "--detect-rbtest"],
38
+ :unit_test_detect_rbtest2 => ["--detect-rbtest"],
39
+ }
40
+ define_functional_tests "xmpfilter", File.expand_path(DIR + '/../bin/xmpfilter'), tests
41
+ end
42
+
43
+ class TestRctComplete < Test::Unit::TestCase
44
+ extend DefineFunctionalTests
45
+ tests = {
46
+ :completion_rbtest => [ "--rbtest", "--line=6" ],
47
+ :completion_detect_rbtest => [ "--detect-rbtest", "--line=6" ],
48
+ :completion_detect_rbtest2 => [ "--detect-rbtest", "--line=1" ],
49
+ }
50
+ define_functional_tests "rct-complete", File.expand_path(DIR + '/../bin/rct-complete'), tests
51
+ end
52
+
53
+ class TestRctDoc < Test::Unit::TestCase
54
+ extend DefineFunctionalTests
55
+ tests = {
56
+ :doc_rbtest => [ "--rbtest", "--line=6" ],
57
+ :doc_detect_rbtest => [ "--detect-rbtest", "--line=1" ],
58
+ :doc_detect_rbtest2 => [ "--detect-rbtest", "--line=6" ],
59
+ }
60
+ define_functional_tests "rct-doc", File.expand_path(DIR + '/../bin/rct-doc'), tests
61
+ end
62
+
63
+
64
+ # Other tests are in test_run.rb
65
+ class TestRctCompleteTDC < Test::Unit::TestCase
66
+ test = :completion_in_method
67
+ inputfile = "#{DIR}/data/#{test}-input.rb"
68
+ outputfile = "#{DIR}/data/#{test}-output.rb"
69
+ test_script = "#{DIR}/data/#{test}-test.rb"
70
+ common_opts = ["--filename #{inputfile}", "--line 2"]
71
+ right_output = File.read(outputfile)
72
+ wrong_output = "\n"
73
+
74
+ tests = {
75
+ :completion_in_method__testscript =>
76
+ [ common_opts + ["-t #{test_script}"], right_output ],
77
+ :completion_in_method__testmethod =>
78
+ [ common_opts + ["-t #{test_script}@test_fooz"], right_output ],
79
+ :completion_in_method__wrong_testmethod =>
80
+ [ common_opts + ["-t #{test_script}@test_NOT_FOUND"], wrong_output ],
81
+ }
82
+ exec = File.expand_path(DIR + '/../bin/rct-complete')
83
+ # tests.each_pair do |test, (opts, expected)|
84
+ # define_method("test_#{test}") do
85
+ # output = `ruby -I#{LIBDIR} #{exec} #{opts.join(" ")} #{inputfile}`
86
+
87
+ # taffile = "#{DIR}/data/#{bin}/#{test}.taf"
88
+ # open(taffile, "w") do |f|
89
+ # f.puts "=========="
90
+ # f.puts test
91
+ # f.puts "=========="
92
+ # f.puts bin + " " + opts.join(" ")
93
+ # f.puts "=========="
94
+ # f.puts File.read("#{DIR}/data/#{test}-input.rb")
95
+ # f.puts "=========="
96
+ # f.puts File.read("#{DIR}/data/#{test}-output.rb")
97
+ # end
98
+ # end
99
+ # end
100
+
101
+ test=:completion_in_method__testscript
102
+ define_method("test_#{test}") do
103
+ taffile = "#{DIR}/data/rct-complete-TDC/completion_in_method__testscript.taf"
104
+ open(taffile, "w") do |f|
105
+ opts = tests[test]
106
+ f.puts "=========="
107
+ f.puts test
108
+ f.puts "=========="
109
+ f.puts "rct-complete " + opts.join(" ")
110
+ f.puts "=========="
111
+ test0 = :completion_in_method
112
+ f.puts File.read("#{DIR}/data/#{test0}-input.rb")
113
+ f.puts "=========="
114
+ f.puts File.read("#{DIR}/data/#{test0}-output.rb")
115
+ f.puts "=========="
116
+ f.puts File.read("#{DIR}/data/#{test0}-test.rb")
117
+ end
118
+
119
+ end
120
+
121
+ test=:completion_in_method__testmethod
122
+ define_method("test_#{test}") do
123
+ taffile = "#{DIR}/data/rct-complete-TDC/completion_in_method__testmethod.taf"
124
+ open(taffile, "w") do |f|
125
+ opts = tests[test]
126
+ f.puts "=========="
127
+ f.puts test
128
+ f.puts "=========="
129
+ f.puts "rct-complete " + opts.join(" ")
130
+ f.puts "=========="
131
+ test0 = :completion_in_method
132
+ f.puts File.read("#{DIR}/data/#{test0}-input.rb")
133
+ f.puts "=========="
134
+ f.puts File.read("#{DIR}/data/#{test0}-output.rb")
135
+ f.puts "=========="
136
+ f.puts File.read("#{DIR}/data/#{test0}-test.rb")
137
+ end
138
+
139
+ end
140
+
141
+ test=:completion_in_method__wrong_testmethod
142
+ define_method("test_#{test}") do
143
+ taffile = "#{DIR}/data/rct-complete-TDC/completion_in_method__wrong_testmethod.taf"
144
+ open(taffile, "w") do |f|
145
+ opts = tests[test]
146
+ f.puts "=========="
147
+ f.puts test
148
+ f.puts "=========="
149
+ f.puts "rct-complete " + opts.join(" ")
150
+ f.puts "=========="
151
+ test0 = :completion_in_method
152
+ f.puts File.read("#{DIR}/data/#{test0}-input.rb")
153
+ f.puts "=========="
154
+ f.puts
155
+ f.puts "=========="
156
+ f.puts File.read("#{DIR}/data/#{test0}-test.rb")
157
+ end
158
+
159
+ end
160
+
161
+ end
162
+ end
@@ -0,0 +1,66 @@
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
+ # :rspec_poetry => {:klass => XMPRSpecFilter, :interpreter => "spec", :use_parentheses => false},
15
+ :rspec_poetry => ["xmpfilter", "-s --poetry"],
16
+ # :unit_test_poetry => {:klass => XMPTestUnitFilter, :use_parentheses => false},
17
+ :unit_test_poetry => ["xmpfilter", "-u --poetry"],
18
+
19
+ # :completion => {:klass => XMPCompletionFilter, :lineno => 1},
20
+ :completion => ["rct-complete", "-C --line=1"],
21
+ # :completion_emacs => {:klass => XMPCompletionEmacsFilter, :lineno => 1},
22
+ :completion_emacs => ["rct-complete", "--completion-emacs --line=1"],
23
+ # :completion_emacs_icicles => {:klass => XMPCompletionEmacsIciclesFilter, :lineno => 1},
24
+ :completion_emacs_icicles => ["rct-complete","--completion-emacs-icicles --line=1"],
25
+ # :completion_class_info => {:klass => XMPCompletionClassInfoFilter, :lineno => 1},
26
+ :completion_class_info => ["rct-complete", "--completion-class-info --line=1"],
27
+ # :completion_class_info_no_candidates => {:klass => XMPCompletionClassInfoFilter, :lineno => 1},
28
+ :completion_class_info_no_candidates => ["rct-complete", "--completion-class-info --line=1"],
29
+
30
+ # :doc => {:klass => XMPDocFilter, :lineno => 1},
31
+ # :refe => {:klass => XMPReFeFilter, :lineno => 1},
32
+ # :ri => {:klass => XMPRiFilter, :lineno => 1},
33
+ # :ri_emacs => {:klass => XMPRiEmacsFilter, :lineno => 1},
34
+ # :ri_vim => {:klass => XMPRiVimFilter, :lineno => 1},
35
+ :doc => ["rct-doc", "-D --line=1"],
36
+ :refe => ["rct-doc", "--refe --line=1"],
37
+ :ri => ["rct-doc", "--ri --line=1"],
38
+ :ri_emacs => ["rct-doc", "--ri-emacs --line=1"],
39
+ :ri_vim => ["rct-doc", "--ri-vim --line=1"],
40
+
41
+ }
42
+ DIR = File.expand_path(File.dirname(__FILE__))
43
+ LIBDIR = File.expand_path(DIR + '/../lib')
44
+
45
+ tests.each_pair do |test, (bin,opts)|
46
+ define_method("test_#{test}") do
47
+ inputfile = "#{DIR}/data/#{test}-input.rb"
48
+ outputfile = "#{DIR}/data/#{test}-output.rb"
49
+
50
+ # exec = File.expand_path(DIR + '/../bin/xmpfilter')
51
+ # output = `ruby -I#{LIBDIR} #{exec} #{opts} #{DIR}/data/#{test}-input.rb`
52
+ # outputfile = "#{DIR}/data/#{test}-output.rb"
53
+ taffile = "#{DIR}/data/#{bin}/#{test}.taf"
54
+ open(taffile, "w") do |f|
55
+ f.puts "=========="
56
+ f.puts test
57
+ f.puts "=========="
58
+ f.puts bin + " " + opts
59
+ f.puts "=========="
60
+ f.puts File.read("#{DIR}/data/#{test}-input.rb")
61
+ f.puts "=========="
62
+ f.puts File.read("#{DIR}/data/#{test}-output.rb")
63
+ end
64
+ end
65
+ end
66
+ end