nguyenchr / atom-cargo-test-runner

Cargo test runner for Atom Editor
https://atom.io/packages/cargo-test-runner
MIT License
5 stars 3 forks source link

out-of-box failure to run tests #4

Open garthk opened 9 years ago

garthk commented 9 years ago

The cargo path is right, as is the root folder, but you're not picking up the tests.

Versions:

nguyenchr commented 9 years ago

Thanks for this, I have been able to reproduce, I'm not sure what the problem is yet but will look into it once I get some free time

jnordwick commented 9 years ago

I'm having the same problem too. Is there a fix yet?

nguyenchr commented 9 years ago

@jnordwick sorry havn't got a fix yet, please feel free to contribute if you have an idea of why it is failing?

jnordwick commented 9 years ago

Would love to... when Atom becomes a little more functional. Moved on to IDEA, since Atom was far behind where I thought it was. I like the idea, but it isn't even up to a good vimrc config yet in ability. Maybe in a few months, I'll revisit (and the Rust tooling should be more polished by then too).

nguyenchr commented 9 years ago

I had a bit of a chance to look into this Looks like my understanding of how cargo filters test could be wrong

Essentially what this plugin does is use the filename from the file that is currently selected to filter out what tests to run From the cargo documentation cargo test -h

For
example, this will run all tests with the name `foo` in their name:

    cargo test foo

So in the above example we are actually running cargo test lib which I would expect this to run all tests in any files that contain lib. If I run cargo test lib from the command line I get

cargo test lib
   Compiling adder v0.0.1 (file:///Users/nguyenchr/Documents/rust/adder)
     Running target/adder-742f3bc3af7d0ced

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

   Doc-tests adder

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
binary132 commented 8 years ago

That is the problem.

When it says "with the name foo in their name" it means the actual test functions, not the files. I just confirmed this by changing the name of my test function to match the name of my test file and it ran.

nguyenchr commented 8 years ago

the fix is now in the latest v0.1.0 release, thanks for the help everyone :)

garthk commented 8 years ago

I'll leave it to you to close it, @nguyenchr; I haven't touched Atom nor Rust for a few months.