PATCH: added new Test::Unit compiler plugin
sroberts at certicom.com
Wed May 5 09:43:27 EDT 2004
Wrote Doug Kearns <djkea2 at mugca.its.monash.edu.au>, on Wed, May 05, 2004 at 05:02:42PM +1000:
> On Sat, May 01, 2004 at 01:00:03PM -0400, Sam Roberts wrote:
> > Quoteing djkea2 at mugca.its.monash.edu.au, on Sat, May 01, 2004 at 03:57:44PM +1000:
> > > On Fri, Apr 30, 2004 at 11:16:45PM -0400, Sam Roberts wrote:
> > > Can't you just have something like:
> > >
> > > -- Makefile --
> > > test:
> > > ruby test_vim.rb
> > > --------------
> > >
> > > % make test
> > That's exactly what I do, except I run make from inside vim, and your
> > rubyunit.vim sets makeprg=ruby, and I want makeprg to be make, the
> > genuine article!
> Well, why not set it to the genuine article?
But I had it set to the genuine article, then the ruby support files
I'm under the impression that these files are going to be part of vim6,
part of the standard distribution, so should be useable as shipped for a
wide variety of usage patterns. I don't think that the ruby file that a
person would be editing will be "runnable" in any case other than very
small projects, so most people will have to customize it.
The only cases this would seem to be useable for is when:
a - you are editing the tests, and the tested code won't throw any
exceptions, its just test that will fail
b - the file you are editing has the tests at the end using the if
c - you're editing the "main" file of a ruby script, and the script
is runnable with no arguments
In any other case (you're editing the file with the code that's causing
the tests to fail, for example), makeprg=ruby won't work.
So, I think setting makeprg to ruby only works for specific cases, it
shouldn't be the default.
My two bits, I'll stop bugging you guys (after this email).
> :compiler rubyunit
> :setlocal makeprg=make
And I will do something like this, but I'll have to write my own
compiler file, and figure out enough about error formats to merge
the error formats in ruby.vim and rubyunit.vim.
> I only suggested it since you asked how to "modify the test/unit" which
> I didn't quite understand but read to mean that you wanted to modify the
> Test::Unit library. I assume this would probably be easier from Rake.
Did I say this? Sorry, I don't want to do that! Though I confess that
I've thought about it... if I could modify the console test runner to
spit out errors in "<file>:<line>:<msg>" format, I wouldn't need
to customize vim's error formats!
Again, I'm trying (unsuccesfully, apparently :-), to make the case that
what ruby users have in common is that when they run ruby code, unit
tests or some other code, that when ruby dies with an error or test/unit
dies with an error, we would like vim to go to the error line, without
needing any customization other than "set filetype on".
How we run our code is a local decision, there isn't a
"one-solution-fits-many", so until the ruby world all starts using rake,
or something, then makeprg should remain unset.
> Compiler plugins are generally defined as a combination of 'efm' and
> 'makeprg' settings. However these options _can_ be changed after setting
> them with :compiler
I grepped my /usr/share/vim... plugins, its not that general, some do,
some don't, and tex.vim does it conditionally.
For a bunch it would seem like changing makeprg would be a good thing
(if you're using bcc, msvc, or some fortran tool-chain, you likely do
want to use the vendor-supplied make utility, though I'm sure there are
folks who'd rather use GNU make). I don't think ruby falls into these
case, I'm starting to repeat myself here...
> > - by changing makepgr to ruby, it causes the appearance of a "hang"
> > when
> > one does ":make" (ruby, without arguments, tries to read stdin, so
> > it
> > just sits there).
> Yes. I generally don't like setting the makeprg to something like
> makeprg=command\ % because it lacks flexibility. I'm not sure what else
> to do here. Any ideas?
1 - don't set makeprg
2 - only set makeprg if there is no makefile
(which is dicy, still, what if I have makeprg is set to "cook", and I
have a cookfile? should the plugin have knowledge of all the worlds
make programs built into it?)
3 - if its possible in vim's script language, have the current file be
the default argument to "ruby", but if somebody called ":make
some_file", have some_file be the argument
Ok, so in the time I've written this, maybe it would have been more
productive for me to learn how to write my own errorformat commands, so
that I can figure out how to merge the two error formats.
Sam Roberts <sroberts at certicom.com>
More information about the vim-ruby-devel