Test::Unit compiler status (was Re: :compiler in the ftplugin)

Doug Kearns djkea2 at mugca.its.monash.edu.au
Wed May 19 03:28:42 EDT 2004


Well, the Test::Unit compiler is still a work in progress, I just
haven't been able to find the time, only an hour or two, to immerse
myself in :help efm, unfortunately.  

Here's an example of the current usage, using Sam's example files.

-- vim.rb -------
#!/usr/bin/ruby -w

require 'test/unit'
require 'vim'

class TestVim < Test::Unit::TestCase
  def test_external
    assert_equal(0, Vim::ok(1), "who would've thought :ok could fail?")
  end

  def test_internal
    assert_equal(0, Vim::fail(0))
  end
end
-----------------

-- test_vim.rb --
module Vim
  def Vim.ok(x)
    x
  end

  def Vim.fail(x)
    x + "hi"  # note that this code will fail when x is a number
  end
end
-----------------


$ ls
test_vim.rb  vim.rb


$ vim vim.rb


:compiler rubyunit


:make test_vim.rb
test_vim.rb
:!ruby test_vim.rb 2>&1| tee /tmp/v954599/1
Loaded suite test_vim
Started
FE
Finished in 0.033088 seconds.

  1) Failure:
test_external(TestVim) [test_vim.rb:8]:
who would've thought :ok could fail?.
<0> expected but was
<1>.

  2) Error:
test_internal(TestVim):
TypeError: String can't be coerced into Fixnum
    ./vim.rb:7:in `+'
    ./vim.rb:7:in `fail'
    test_vim.rb:12:in `test_internal'

2 tests, 1 assertions, 1 failures, 1 errors

Hit ENTER or type command to continue


:clist
 2 test_vim.rb:8 error:  who would've thought :ok could fail?
 8 vim.rb:7 error: 
 9 vim.rb:7 error: 
10 test_vim.rb:12 error:


:clist!
 1: 
 2 test_vim.rb:8 error:  who would've thought :ok could fail?
 3: <0> expected but was
 4: <1>.
 5: 
 6: test_internal(TestVim):
 7: TypeError: String can't be coerced into Fixnum
 8 vim.rb:7 error: 
 9 vim.rb:7 error: 
10 test_vim.rb:12 error: 
11: 
12: 2 tests, 1 assertions, 1 failures, 1 errors
Hit ENTER or type command to continue


Now you can use :cwin, :cn, :cp, :crew and friends to move between these
errors.

Regards,
Doug


More information about the vim-ruby-devel mailing list