[rust-dev] Using 'mod' for test code
allen.welkie at gmail.com
Wed Jul 23 10:32:17 PDT 2014
I'm having an issue with creating a separate testing file for a program I'm
writing. I have a file called 'myprogram.rs', which imports complex numbers
with the following
extern crate num;
and then defines a bunch of functions. I want to test these functions in a
separate file. So I created 'testprogram.rs' and import the myprogram
functions using the 'mod' keyword:
But when I try to compile test.rs with the --test flag, I get the following
error for myprogram.rs:
"unresolved import 'num::complex::Complex'. Did you mean
What's going on here? How can I import my program to create a test suite.
Also, is this the preferred way of creating a test suite (using the 'mod'
keyword)? Or should I compile 'myprogram.rs' into a crate and import the
crate into 'test.rs'?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rust-dev