Fix cfg completions not working

This commit is contained in:
Lukas Wirth 2023-08-29 10:57:24 +02:00
parent ca6ddd8ea3
commit 853f8a21f7
4 changed files with 98 additions and 33 deletions

View file

@ -66,11 +66,6 @@ struct Foo;
)
}
#[test]
fn inside_nested_attr() {
check(r#"#[cfg($0)]"#, expect![[]])
}
#[test]
fn with_existing_attr() {
check(
@ -635,6 +630,32 @@ struct Foo;
mod cfg {
use super::*;
#[test]
fn inside_cfg() {
check(
r#"
//- /main.rs cfg:test,dbg=false,opt_level=2
#[cfg($0)]
"#,
expect![[r#"
ba dbg
ba opt_level
ba test
"#]],
);
check(
r#"
//- /main.rs cfg:test,dbg=false,opt_level=2
#[cfg(b$0)]
"#,
expect![[r#"
ba dbg
ba opt_level
ba test
"#]],
);
}
#[test]
fn cfg_target_endian() {
check(
@ -644,6 +665,13 @@ mod cfg {
ba little
"#]],
);
check(
r#"#[cfg(target_endian = b$0"#,
expect![[r#"
ba big
ba little
"#]],
);
}
}