Skip to content

Commit 3e2573c

Browse files
committed
add new tests
1 parent 83cb650 commit 3e2573c

5 files changed

Lines changed: 33 additions & 1 deletion

File tree

tests/ui/resolve/open-ns-10.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Tests that namespaced crate names are limited to two segments
2+
3+
//@ aux-crate: nscrate::three::segments=open-ns-my_api_utils.rs
4+
//@ compile-flags: -Z namespaced-crates
5+
//@ edition: 2024
6+
//~? ERROR crate name `nscrate::three::segments` passed to `--extern` can have at most two segments.
7+
8+
fn main() {}

tests/ui/resolve/open-ns-10.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
error: crate name `nscrate::three::segments` passed to `--extern` can have at most two segments.
2+

tests/ui/resolve/open-ns-11.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Tests that namespaced crate names are limited to two segments
2+
3+
//@ aux-crate: std::utils=open-ns-my_api_utils.rs
4+
//@ compile-flags: -Z namespaced-crates
5+
//@ edition: 2024
6+
7+
use std::utils::get_u32;
8+
//~^ ERROR unresolved import `std::utils`
9+
10+
fn main() {
11+
let _ = get_u32();
12+
}

tests/ui/resolve/open-ns-11.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0432]: unresolved import `std::utils`
2+
--> $DIR/open-ns-11.rs:7:10
3+
|
4+
LL | use std::utils::get_u32;
5+
| ^^^^^ could not find `utils` in `std`
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0432`.

tests/ui/resolve/open-ns-5.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ macro_rules! import_and_call {
1313
}
1414

1515
fn main() {
16-
import_and_call!(my_api::utils::utils_helper, utils_helper)
16+
import_and_call!(my_api::utils::utils_helper, utils_helper);
17+
let _x = 4 + 5;
1718
}

0 commit comments

Comments
 (0)