There too many super keywords for function tests

I use such construction in normal "executable crate" case:

// main.rs
mod a;
mod b;
fn main() {}
//a.rs
pub fn a_f() {}
//b.rs
use super::a;

pub fn b() {
    a::a_f();
}

but if I try to use the same code for functional test:

tests/functional_test.rs
tests/a.rs
tests/b.rs

then cargo+rustc tells me:

error[E0433]: failed to resolve: there are too many leading `super` keywords
 --> tests/b.rs:1:5
  |
1 | use super::a;
  |     ^^^^^ there are too many leading `super` keywords

why and how can I fix this?

Each .rs file directly in the tests directory is considered an independant module.

If you want to structure your integration tests in modules you have to put them in a subdirectory.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.