mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-27 18:26:19 +00:00
Fix test_keyword_highlighting test
This commit is contained in:
parent
8f319240b4
commit
716e9fdb8d
7 changed files with 107 additions and 38 deletions
|
|
@ -218,16 +218,11 @@ impl FixtureWithProjectMeta {
|
|||
);
|
||||
}
|
||||
|
||||
if line.starts_with("//-") {
|
||||
if let Some(line) = line.strip_prefix("//-") {
|
||||
let meta = Self::parse_meta_line(line);
|
||||
res.push(meta);
|
||||
} else {
|
||||
if line.starts_with("// ")
|
||||
&& line.contains(':')
|
||||
&& !line.contains("::")
|
||||
&& !line.contains('.')
|
||||
&& line.chars().all(|it| !it.is_uppercase())
|
||||
{
|
||||
if matches!(line.strip_prefix("// "), Some(l) if l.trim().starts_with('/')) {
|
||||
panic!("looks like invalid metadata line: {line:?}");
|
||||
}
|
||||
|
||||
|
|
@ -242,8 +237,7 @@ impl FixtureWithProjectMeta {
|
|||
|
||||
//- /lib.rs crate:foo deps:bar,baz cfg:foo=a,bar=b env:OUTDIR=path/to,OTHER=foo
|
||||
fn parse_meta_line(meta: &str) -> Fixture {
|
||||
assert!(meta.starts_with("//-"));
|
||||
let meta = meta["//-".len()..].trim();
|
||||
let meta = meta.trim();
|
||||
let mut components = meta.split_ascii_whitespace();
|
||||
|
||||
let path = components.next().expect("fixture meta must start with a path").to_owned();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue