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;
  use num::complex::Complex;

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:

  mod myprogram;

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
'self::num::complex'?

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'?
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to