rcodetools 0.7.0.0 → 0.8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/CHANGES +12 -0
  2. data/README +1 -1
  3. data/README.emacs +21 -4
  4. data/README.ja +1 -1
  5. data/README.xmpfilter +159 -74
  6. data/Rakefile +3 -37
  7. data/anything-rcodetools.el +142 -0
  8. data/bin/rct-complete +1 -1
  9. data/bin/rct-doc +1 -1
  10. data/bin/rct-meth-args +33 -2
  11. data/bin/xmpfilter +5 -1
  12. data/lib/rcodetools/compat.rb +14 -0
  13. data/lib/rcodetools/completion.rb +8 -6
  14. data/lib/rcodetools/fork.rb +15 -8
  15. data/lib/rcodetools/options.rb +8 -0
  16. data/lib/rcodetools/xmpfilter.rb +80 -33
  17. data/lib/rcodetools/xmptestunitfilter.rb +76 -21
  18. data/lib/ruby_toggle_file.rb +1 -1
  19. data/rcodetools.el +213 -20
  20. data/test/test_functional.rb +36 -68
  21. data/test/test_method_analyzer.rb +28 -20
  22. data/test/test_ruby_toggle_file.rb +118 -69
  23. data/test/test_xmpfilter.rb +75 -47
  24. data/test/test_xmptestunitfilter.rb +12 -11
  25. metadata +83 -133
  26. data/test/data/add_markers-input.rb +0 -2
  27. data/test/data/add_markers-output.rb +0 -2
  28. data/test/data/bindings-input.rb +0 -26
  29. data/test/data/bindings-output.rb +0 -31
  30. data/test/data/completion-input.rb +0 -1
  31. data/test/data/completion-output.rb +0 -2
  32. data/test/data/completion_class_info-input.rb +0 -1
  33. data/test/data/completion_class_info-output.rb +0 -10
  34. data/test/data/completion_class_info_no_candidates-input.rb +0 -1
  35. data/test/data/completion_class_info_no_candidates-output.rb +0 -1
  36. data/test/data/completion_detect_rbtest-input.rb +0 -7
  37. data/test/data/completion_detect_rbtest-output.rb +0 -2
  38. data/test/data/completion_detect_rbtest2-input.rb +0 -1
  39. data/test/data/completion_detect_rbtest2-output.rb +0 -2
  40. data/test/data/completion_emacs-input.rb +0 -1
  41. data/test/data/completion_emacs-output.rb +0 -6
  42. data/test/data/completion_emacs_icicles-input.rb +0 -1
  43. data/test/data/completion_emacs_icicles-output.rb +0 -6
  44. data/test/data/completion_in_method-input.rb +0 -3
  45. data/test/data/completion_in_method-output.rb +0 -1
  46. data/test/data/completion_in_method-test.rb +0 -6
  47. data/test/data/completion_rbtest-input.rb +0 -7
  48. data/test/data/completion_rbtest-output.rb +0 -2
  49. data/test/data/doc-input.rb +0 -1
  50. data/test/data/doc-output.rb +0 -1
  51. data/test/data/doc_detect_rbtest-input.rb +0 -1
  52. data/test/data/doc_detect_rbtest-output.rb +0 -1
  53. data/test/data/doc_detect_rbtest2-input.rb +0 -7
  54. data/test/data/doc_detect_rbtest2-output.rb +0 -1
  55. data/test/data/doc_rbtest-input.rb +0 -7
  56. data/test/data/doc_rbtest-output.rb +0 -1
  57. data/test/data/no_warnings-input.rb +0 -3
  58. data/test/data/no_warnings-output.rb +0 -4
  59. data/test/data/refe-input.rb +0 -1
  60. data/test/data/refe-output.rb +0 -1
  61. data/test/data/ri-input.rb +0 -1
  62. data/test/data/ri-output.rb +0 -1
  63. data/test/data/ri_emacs-input.rb +0 -1
  64. data/test/data/ri_emacs-output.rb +0 -1
  65. data/test/data/ri_vim-input.rb +0 -1
  66. data/test/data/ri_vim-output.rb +0 -1
  67. data/test/data/rspec-input.rb +0 -48
  68. data/test/data/rspec-output.rb +0 -52
  69. data/test/data/rspec_poetry-input.rb +0 -48
  70. data/test/data/rspec_poetry-output.rb +0 -52
  71. data/test/data/simple_annotation-input.rb +0 -8
  72. data/test/data/simple_annotation-output.rb +0 -8
  73. data/test/data/unit_test-input.rb +0 -50
  74. data/test/data/unit_test-output.rb +0 -52
  75. data/test/data/unit_test_detect_rbtest-input.rb +0 -50
  76. data/test/data/unit_test_detect_rbtest-output.rb +0 -52
  77. data/test/data/unit_test_detect_rbtest2-input.rb +0 -6
  78. data/test/data/unit_test_detect_rbtest2-output.rb +0 -6
  79. data/test/data/unit_test_poetry-input.rb +0 -50
  80. data/test/data/unit_test_poetry-output.rb +0 -52
  81. data/test/data/unit_test_rbtest-input.rb +0 -6
  82. data/test/data/unit_test_rbtest-output.rb +0 -6
  83. data/test/test_run.rb +0 -45
@@ -2,12 +2,13 @@ require 'rcodetools/xmpfilter'
2
2
 
3
3
  module Rcodetools
4
4
 
5
+ FLOAT_TOLERANCE = 0.0001
5
6
  class XMPTestUnitFilter < XMPFilter
6
7
  def initialize(opts = {})
7
8
  super
8
9
  @output_stdout = false
9
10
  mod = @parentheses ? :WithParentheses : :Poetry
10
- extend self.class.const_get(mod)
11
+ extend self.class.const_get(mod) unless opts[:_no_extend_module]
11
12
  end
12
13
 
13
14
  private
@@ -73,7 +74,7 @@ class XMPTestUnitFilter < XMPFilter
73
74
  def value_assertions(klass_txt, value_txt, value, expression)
74
75
  case value
75
76
  when Float
76
- ["assert_in_delta(#{value.inspect}, #{expression}, 0.0001)"]
77
+ ["assert_in_delta(#{value.inspect}, #{expression}, #{FLOAT_TOLERANCE})"]
77
78
  when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass
78
79
  ["assert_equal(#{value_txt}, #{expression})"]
79
80
  else
@@ -99,7 +100,7 @@ class XMPTestUnitFilter < XMPFilter
99
100
  def value_assertions(klass_txt, value_txt, value, expression)
100
101
  case value
101
102
  when Float
102
- ["assert_in_delta #{value.inspect}, #{expression}, 0.0001"]
103
+ ["assert_in_delta #{value.inspect}, #{expression}, #{FLOAT_TOLERANCE}"]
103
104
  when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass
104
105
  ["assert_equal #{value_txt}, #{expression}"]
105
106
  else
@@ -119,26 +120,36 @@ class XMPTestUnitFilter < XMPFilter
119
120
  end
120
121
 
121
122
  class XMPRSpecFilter < XMPTestUnitFilter
122
- private
123
- alias :execute :execute_script
124
-
125
- def interpreter_command
126
- [@interpreter] + @libs.map{|x| "-r#{x}"}
123
+ def initialize(x={})
124
+ super(x.merge(:_no_extend_module => true))
125
+ load_rspec
126
+ specver = (Spec::VERSION::STRING rescue "1.0.0")
127
+ api_module = specver >= "0.8.0" ? NewAPI : OldAPI
128
+ mod = @parentheses ? :WithParentheses : :Poetry
129
+ extend api_module.const_get(mod)
130
+ extend api_module
127
131
  end
128
132
 
129
- begin
130
- require 'spec/version'
131
- rescue LoadError
132
- require 'rubygems'
133
+ private
134
+ def load_rspec
133
135
  begin
134
136
  require 'spec/version'
135
- rescue LoadError # if rspec isn't available, use most recent conventions
136
- module Spec::VERSION; STRING = "1.0.0" end
137
+ rescue LoadError
138
+ require 'rubygems'
139
+ begin
140
+ require 'spec/version'
141
+ rescue LoadError # if rspec isn't available, use most recent conventions
142
+ end
137
143
  end
138
144
  end
139
145
 
140
- if Spec::VERSION::STRING >= "0.8.0"
146
+ alias :execute :execute_script
141
147
 
148
+ def interpreter_command
149
+ [@interpreter] + @libs.map{|x| "-r#{x}"}
150
+ end
151
+
152
+ module NewAPI
142
153
  def raise_assertion(expression, exceptions, index)
143
154
  ["lambda{#{expression}}.should raise_error(#{exceptions[index][0]})"]
144
155
  end
@@ -151,7 +162,7 @@ class XMPRSpecFilter < XMPTestUnitFilter
151
162
  def value_assertions(klass_txt, value_txt, value, expression)
152
163
  case value
153
164
  when Float
154
- ["(#{expression}).should be_close(#{value.inspect}, 0.0001)"]
165
+ ["(#{expression}).should be_close(#{value.inspect}, #{FLOAT_TOLERANCE})"]
155
166
  when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass
156
167
  ["(#{expression}).should == (#{value_txt})"]
157
168
  else
@@ -177,7 +188,7 @@ class XMPRSpecFilter < XMPTestUnitFilter
177
188
  def value_assertions(klass_txt, value_txt, value, expression)
178
189
  case value
179
190
  when Float
180
- ["#{expression}.should be_close(#{value.inspect}, 0.0001)"]
191
+ ["#{expression}.should be_close(#{value.inspect}, #{FLOAT_TOLERANCE})"]
181
192
  when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass
182
193
  ["#{expression}.should == #{value_txt}"]
183
194
  else
@@ -194,7 +205,9 @@ class XMPRSpecFilter < XMPTestUnitFilter
194
205
  "#{actual}.should == #{expected}"
195
206
  end
196
207
  end
197
- else
208
+ end
209
+
210
+ module OldAPI
198
211
  # old rspec, use deprecated syntax
199
212
  def raise_assertion(expression, exceptions, index)
200
213
  ["lambda{#{expression}}.should_raise_error(#{exceptions[index][0]})"]
@@ -208,7 +221,7 @@ class XMPRSpecFilter < XMPTestUnitFilter
208
221
  def value_assertions(klass_txt, value_txt, value, expression)
209
222
  case value
210
223
  when Float
211
- ["(#{expression}).should_be_close(#{value.inspect}, 0.0001)"]
224
+ ["(#{expression}).should_be_close(#{value.inspect}, #{FLOAT_TOLERANCE})"]
212
225
  when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass
213
226
  ["(#{expression}).should_equal(#{value_txt})"]
214
227
  else
@@ -234,7 +247,7 @@ class XMPRSpecFilter < XMPTestUnitFilter
234
247
  def value_assertions(klass_txt, value_txt, value, expression)
235
248
  case value
236
249
  when Float
237
- ["#{expression}.should_be_close #{value.inspect}, 0.0001"]
250
+ ["#{expression}.should_be_close #{value.inspect}, #{FLOAT_TOLERANCE}"]
238
251
  when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass
239
252
  ["#{expression}.should_equal #{value_txt}"]
240
253
  else
@@ -253,6 +266,48 @@ class XMPRSpecFilter < XMPTestUnitFilter
253
266
  end
254
267
  end
255
268
 
256
- end
257
269
 
258
270
  end
271
+
272
+ class XMPExpectationsFilter < XMPTestUnitFilter
273
+ def initialize(x={})
274
+ super(x.merge(:_no_extend_module => true))
275
+ @warnings = false
276
+ end
277
+
278
+ def expectation(expected, actual)
279
+ <<EOE
280
+ expect #{expected} do
281
+ #{actual}
282
+ end
283
+ EOE
284
+ end
285
+ alias :equal_assertion :expectation
286
+
287
+ def raise_assertion(expression, exceptions, index)
288
+ [ expectation(exceptions[index][0], expression) ]
289
+ end
290
+
291
+ def nil_assertion(expression)
292
+ [ expectation("nil", expression) ]
293
+ end
294
+
295
+ def value_assertions(klass_txt, value_txt, value, expression)
296
+ case value
297
+ when Float
298
+ min = "%.4f" % [value - FLOAT_TOLERANCE]
299
+ max = "%.4f" % [value + FLOAT_TOLERANCE]
300
+ [ expectation("#{min}..#{max}", expression) ]
301
+ when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass
302
+ [ expectation(value_txt, expression) ]
303
+ else
304
+ object_assertions klass_txt, value_txt, expression
305
+ end
306
+ end
307
+
308
+ def object_assertions(klass_txt, value_txt, expression)
309
+ [ expectation(klass_txt, expression),
310
+ expectation(value_txt.inspect, "#{expression}.inspect") ]
311
+ end
312
+ end # /XMPExpectationsFilter
313
+ end # /Rcodetools
@@ -35,7 +35,7 @@ class RubyToggleFile
35
35
  run_hooks_with_args_until_success %r/^implementation_file_/, test, m&&(m.pre_match+"/"), m&&m[1], m&&m[2]
36
36
  end
37
37
 
38
- private
38
+ # private
39
39
  def exist(file)
40
40
  file if File.exist? file
41
41
  end
data/rcodetools.el CHANGED
@@ -1,10 +1,10 @@
1
1
  ;;; rcodetools.el -- annotation / accurate completion / browsing documentation
2
2
 
3
- ;;; Copyright (c) 2006 rubikitch <rubikitch@ruby-lang.org>
3
+ ;;; Copyright (c) 2006-2008 rubikitch <rubikitch@ruby-lang.org>
4
4
  ;;;
5
5
  ;;; Use and distribution subject to the terms of the Ruby license.
6
6
 
7
- (defvar xmpfilter-command-name "ruby -S xmpfilter --dev --detect-rbtest"
7
+ (defvar xmpfilter-command-name "ruby -S xmpfilter --dev --fork --detect-rbtest"
8
8
  "The xmpfilter command name.")
9
9
  (defvar rct-doc-command-name "ruby -S rct-doc --dev --fork --detect-rbtest"
10
10
  "The rct-doc command name.")
@@ -12,6 +12,7 @@
12
12
  "The rct-complete command name.")
13
13
  (defvar ruby-toggle-file-command-name "ruby -S ruby-toggle-file"
14
14
  "The ruby-toggle-file command name.")
15
+ (defvar rct-fork-command-name "ruby -S rct-fork")
15
16
  (defvar rct-option-history nil) ;internal
16
17
  (defvar rct-option-local nil) ;internal
17
18
  (make-variable-buffer-local 'rct-option-local)
@@ -55,26 +56,47 @@
55
56
  (read-from-minibuffer "rcodetools option: " option nil nil 'rct-option-history))
56
57
  option))))
57
58
 
59
+ (defun rct-shell-command (command &optional buffer)
60
+ "Replacement for `(shell-command-on-region (point-min) (point-max) command buffer t' because of encoding problem."
61
+ (let ((input-rb (concat (make-temp-name "xmptmp-in") ".rb"))
62
+ (output-rb (concat (make-temp-name "xmptmp-out") ".rb"))
63
+ (coding-system-for-read buffer-file-coding-system))
64
+ (write-region (point-min) (point-max) input-rb nil 'nodisp)
65
+ (shell-command
66
+ (rct-debuglog (format "%s %s > %s" command input-rb output-rb))
67
+ t " *rct-error*")
68
+ (and buffer (set-buffer buffer))
69
+ (insert-file-contents output-rb nil nil nil t)
70
+ (delete-file input-rb)
71
+ (delete-file output-rb)))
72
+
73
+ (defvar xmpfilter-command-function 'xmpfilter-command)
58
74
  (defun xmp (&optional option)
59
75
  "Run xmpfilter for annotation/test/spec on whole buffer.
60
76
  See also `rct-interactive'. "
61
77
  (interactive (rct-interactive))
62
78
  (rct-save-position
63
- (lambda () (shell-command-on-region (point-min) (point-max) (xmpfilter-command option) t t " *rct-error*"))))
79
+ (lambda ()
80
+ (rct-shell-command (funcall xmpfilter-command-function option)))))
64
81
 
65
82
  (defun xmpfilter-command (&optional option)
66
83
  "The xmpfilter command line, DWIM."
67
84
  (setq option (or option ""))
68
- (cond ((save-excursion
69
- (goto-char 1)
70
- (search-forward "< Test::Unit::TestCase" nil t))
71
- (format "%s --unittest %s" xmpfilter-command-name option))
72
- ((save-excursion
73
- (goto-char 1)
74
- (re-search-forward "^context.+do$" nil t))
75
- (format "%s --spec %s" xmpfilter-command-name option))
76
- (t
77
- (format "%s %s" xmpfilter-command-name option))))
85
+ (flet ((in-block (beg-re)
86
+ (save-excursion
87
+ (goto-char (point-min))
88
+ (when (re-search-forward beg-re nil t)
89
+ (let ((s (point)) e)
90
+ (when (re-search-forward "^end\n" nil t)
91
+ (setq e (point))
92
+ (goto-char s)
93
+ (re-search-forward "# => *$" e t)))))))
94
+ (cond ((in-block "^class.+< Test::Unit::TestCase$")
95
+ (format "%s --unittest %s" xmpfilter-command-name option))
96
+ ((in-block "^\\(describe\\|context\\).+do$")
97
+ (format "%s --spec %s" xmpfilter-command-name option))
98
+ (t
99
+ (format "%s %s" xmpfilter-command-name option)))))
78
100
 
79
101
  ;;;; Completion
80
102
  (defvar rct-method-completion-table nil) ;internal
@@ -130,13 +152,12 @@ See also `rct-interactive'."
130
152
  "Execute rct-complete/rct-doc and evaluate the output."
131
153
  (let ((eval-buffer (get-buffer-create " *rct-eval*")))
132
154
  ;; copy to temporary buffer to do completion at non-EOL.
133
- (shell-command-on-region
134
- (point-min) (point-max)
135
- (rct-debuglog (format "%s %s %s --line=%d --column=%d %s"
136
- command opt (or rct-option-local "")
137
- (rct-current-line) (current-column)
138
- (if rct-use-test-script (rct-test-script-option-string) "")))
139
- eval-buffer nil " *rct-error*")
155
+ (rct-shell-command
156
+ (format "%s %s %s --line=%d --column=%d %s"
157
+ command opt (or rct-option-local "")
158
+ (rct-current-line) (current-column)
159
+ (if rct-use-test-script (rct-test-script-option-string) ""))
160
+ eval-buffer)
140
161
  (message "")
141
162
  (eval (with-current-buffer eval-buffer
142
163
  (goto-char 1)
@@ -213,5 +234,177 @@ See also `rct-interactive'. "
213
234
  (find-file (shell-command-to-string
214
235
  (format "%s %s" ruby-toggle-file-command-name buffer-file-name))))
215
236
 
237
+ ;;;; rct-fork support
238
+ (defun rct-fork (options)
239
+ "Run rct-fork.
240
+ Rct-fork makes xmpfilter and completion MUCH FASTER because it pre-loads heavy libraries.
241
+ When rct-fork is running, the mode-line indicates it to avoid unnecessary run.
242
+ To kill rct-fork process, use \\[rct-fork-kill].
243
+ "
244
+ (interactive "srct-fork options (-e CODE -I LIBDIR -r LIB): ")
245
+ (rct-fork-kill)
246
+ (rct-fork-minor-mode 1)
247
+ (start-process-shell-command
248
+ "rct-fork" "*rct-fork*" rct-fork-command-name options))
249
+ (defun rct-fork-kill ()
250
+ "Kill rct-fork process invoked by \\[rct-fork]."
251
+ (interactive)
252
+ (when rct-fork-minor-mode
253
+ (rct-fork-minor-mode -1)
254
+ (interrupt-process "rct-fork")))
255
+ (define-minor-mode rct-fork-minor-mode
256
+ "This minor mode is turned on when rct-fork is run.
257
+ It is nothing but an indicator."
258
+ :lighter " <rct-fork>" :global t)
259
+
260
+ ;;;; unit tests
261
+ (when (and (fboundp 'expectations))
262
+ (require 'ruby-mode)
263
+ (require 'el-mock nil t)
264
+ (expectations
265
+ (desc "comment-dwim advice")
266
+ (expect "# =>"
267
+ (with-temp-buffer
268
+ (ruby-mode)
269
+ (setq last-command nil)
270
+ (call-interactively 'comment-dwim)
271
+ (setq last-command 'comment-dwim)
272
+ (call-interactively 'comment-dwim)
273
+ (buffer-string)))
274
+ (expect (regexp "^1 +# =>")
275
+ (with-temp-buffer
276
+ (ruby-mode)
277
+ (insert "1")
278
+ (setq last-command nil)
279
+ (call-interactively 'comment-dwim)
280
+ (setq last-command 'comment-dwim)
281
+ (call-interactively 'comment-dwim)
282
+ (buffer-string)))
283
+
284
+ (desc "rct-current-line")
285
+ (expect 1
286
+ (with-temp-buffer
287
+ (rct-current-line)))
288
+ (expect 1
289
+ (with-temp-buffer
290
+ (insert "1")
291
+ (rct-current-line)))
292
+ (expect 2
293
+ (with-temp-buffer
294
+ (insert "1\n")
295
+ (rct-current-line)))
296
+ (expect 2
297
+ (with-temp-buffer
298
+ (insert "1\n2")
299
+ (rct-current-line)))
300
+
301
+ (desc "rct-save-position")
302
+ (expect (mock (set-window-start * 7) => nil)
303
+ (stub window-start => 7)
304
+ (with-temp-buffer
305
+ (insert "abcdef\nghi")
306
+ (rct-save-position #'ignore)))
307
+ (expect 2
308
+ (with-temp-buffer
309
+ (stub window-start => 1)
310
+ (stub set-window-start => nil)
311
+ (insert "abcdef\nghi")
312
+ (rct-save-position #'ignore)
313
+ (rct-current-line)))
314
+ (expect 3
315
+ (with-temp-buffer
316
+ (stub window-start => 1)
317
+ (stub set-window-start => nil)
318
+ (insert "abcdef\nghi")
319
+ (rct-save-position #'ignore)
320
+ (current-column)))
321
+
322
+ (desc "rct-interactive")
323
+ (expect '("read")
324
+ (let ((current-prefix-arg t))
325
+ (stub read-from-minibuffer => "read")
326
+ (rct-interactive)))
327
+ (expect '("-S ruby19")
328
+ (let ((current-prefix-arg nil)
329
+ (rct-option-local "-S ruby19"))
330
+ (stub read-from-minibuffer => "read")
331
+ (rct-interactive)))
332
+ (expect '("")
333
+ (let ((current-prefix-arg nil)
334
+ (rct-option-local))
335
+ (stub read-from-minibuffer => "read")
336
+ (rct-interactive)))
337
+
338
+ (desc "rct-shell-command")
339
+ (expect "1+1 # => 2\n"
340
+ (with-temp-buffer
341
+ (insert "1+1 # =>\n")
342
+ (rct-shell-command "xmpfilter")
343
+ (buffer-string)))
344
+
345
+ (desc "xmp")
346
+
347
+ (desc "xmpfilter-command")
348
+ (expect "xmpfilter --rails"
349
+ (let ((xmpfilter-command-name "xmpfilter"))
350
+ (with-temp-buffer
351
+ (insert "class TestFoo < Test::Unit::TestCase\n")
352
+ (xmpfilter-command "--rails"))))
353
+ (expect "xmpfilter "
354
+ (let ((xmpfilter-command-name "xmpfilter"))
355
+ (with-temp-buffer
356
+ (insert "context 'foo' do\n")
357
+ (xmpfilter-command))))
358
+ (expect "xmpfilter "
359
+ (let ((xmpfilter-command-name "xmpfilter"))
360
+ (with-temp-buffer
361
+ (insert "describe Array do\n")
362
+ (xmpfilter-command))))
363
+ (expect "xmpfilter --unittest --rails"
364
+ (let ((xmpfilter-command-name "xmpfilter"))
365
+ (with-temp-buffer
366
+ (insert "class TestFoo < Test::Unit::TestCase\n"
367
+ " def test_0\n"
368
+ " 1 + 1 # =>\n"
369
+ " end\n"
370
+ "end\n")
371
+ (xmpfilter-command "--rails"))))
372
+ (expect "xmpfilter --spec "
373
+ (let ((xmpfilter-command-name "xmpfilter"))
374
+ (with-temp-buffer
375
+ (insert "context 'foo' do\n"
376
+ " specify \"foo\" do\n"
377
+ " 1 + 1 # =>\n"
378
+ " end\n"
379
+ "end\n")
380
+ (xmpfilter-command))))
381
+ (expect "xmpfilter --spec "
382
+ (let ((xmpfilter-command-name "xmpfilter"))
383
+ (with-temp-buffer
384
+ (insert "describe Array do\n"
385
+ " it \"foo\" do\n"
386
+ " [1] + [1] # =>\n"
387
+ " end\n"
388
+ "end\n")
389
+ (xmpfilter-command))))
390
+ (expect "xmpfilter "
391
+ (let ((xmpfilter-command-name "xmpfilter"))
392
+ (with-temp-buffer
393
+ (insert "1 + 2\n")
394
+ (xmpfilter-command))))
395
+
396
+ (desc "rct-fork")
397
+ (expect t
398
+ (stub start-process-shell-command => t)
399
+ (stub interrupt-process => t)
400
+ (rct-fork "-r activesupport")
401
+ rct-fork-minor-mode)
402
+ (expect nil
403
+ (stub start-process-shell-command => t)
404
+ (stub interrupt-process => t)
405
+ (rct-fork "-r activesupport")
406
+ (rct-fork-kill)
407
+ rct-fork-minor-mode)
408
+ ))
216
409
 
217
410
  (provide 'rcodetools)