vim-rubytest icon indicating copy to clipboard operation
vim-rubytest copied to clipboard

Quickfix output not allowing first error to be opened

Open DanBradbury opened this issue 11 years ago • 8 comments

After setting let g:rubytest_in_quickfix = 1 everything looked to function as expected:

  • Run test
  • Errors added to quickfix

However when the output finishes and the first error is opened the following happens:

screenshot 2014-10-15 10 12 27

It looks like the filename is getting prepended with [ which is leading to the inability to open the actual file.

I am a quickfix noob and tried to use :set modifiable in hopes that I could just remove the [ char and the file would open as desired. Hopefully someone has seen this issue before and there is a quick fix. (in the meantime I'll dig into the code and see if anything stands out)

Investigation How quickfix list is created in the ExecTest(cmd) function

cex system(cmd)

DanBradbury avatar Oct 15 '14 17:10 DanBradbury

I have a rather gross fix for this issue

cex substitute(system(cmd), '\[', '', 'g')

Not sure if there is a cleaner way to handle this issue but for now this is what I am using to get things working.

DanBradbury avatar Oct 15 '14 17:10 DanBradbury

The same problem occurs with rspec3 but instead of [ there is a # on the beginning, so similar ugly hack for this would be:

cex substitute(system(cmd), '#', '', 'g')

or for both cases

cex substitute(system(cmd), '[\[#]', '', 'g')

ajgon avatar Jan 09 '15 08:01 ajgon

Is there anyone owning this project who could advise an ideal solution? (cc: @janx )

It might be worthwhile to apply the "hack" for both cases but i am afraid there are cases that haven't been considered and will require another patch to fix.

DanBradbury avatar Jan 09 '15 16:01 DanBradbury

@DanBradbury can you paste the raw test error log?

janx avatar Jan 20 '15 03:01 janx

Since I cannot reproduce, your minttest/rspec version/settings will be helpful too.

janx avatar Jan 20 '15 03:01 janx

Hey, thanks for taking care of this:

$ gem list | grep rspec                                                                                                                                                                                                                                                                                           rspec (3.1.0)
rspec-core (3.1.7)
rspec-expectations (3.1.2)
rspec-mocks (3.1.3)
rspec-rails (3.1.0)
rspec-support (3.1.2)
spring-commands-rspec (1.0.4)
$ ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]
$ cat .rspec
-r rails_helper
--color
--format=documentation
$ rspec spec/example_spec.rb
...
  1) Example example spec
     Failure/Error: expect { @example.test }.to raise_error(ArgumentError)
       expected ArgumentError but nothing was raised
     # ./spec/example_spec.rb:50:in `block (3 levels) in <top (required)>'
...
rspec ./spec/example_spec.rb:49 # Example example spec

Notice the hashes in error outputs, that's why I added substitution.

ajgon avatar Jan 20 '15 07:01 ajgon

Please let me know if e8e851402f644ee9907766f4ad6c19fe26d9c375 works.

janx avatar Jan 20 '15 08:01 janx

Works like a charm, thank you :smile:

ajgon avatar Jan 20 '15 10:01 ajgon