Skip to content

Commit bd57886

Browse files
committed
Test that auxiliaries are built against their own directives
There are probably plenty of tests that will check this incidentally, but it's convenient to have a dedicated self-test.
1 parent adaa838 commit bd57886

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ edition: 2024
2+
//@ aux-build: aux_with_props.rs
3+
//@ compile-flags: --check-cfg=cfg(this_is_aux)
4+
//@ run-pass
5+
6+
// Test that auxiliaries are built using the directives in the auxiliary file,
7+
// and don't just accidentally use the directives of the main test file.
8+
9+
extern crate aux_with_props;
10+
11+
fn main() {
12+
assert!(!cfg!(this_is_aux));
13+
assert!(aux_with_props::aux_directives_are_respected());
14+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ edition: 2024
2+
//@ compile-flags: --cfg=this_is_aux
3+
4+
pub fn aux_directives_are_respected() -> bool {
5+
cfg!(this_is_aux)
6+
}

0 commit comments

Comments
 (0)