mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Add a dash test
This commit is contained in:
parent
673e1ddb9a
commit
cae2e859ff
@ -162,11 +162,11 @@ impl ChangeFixture {
|
|||||||
meta.env,
|
meta.env,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
);
|
);
|
||||||
let crate_name = CrateName::new(&krate).unwrap();
|
let crate_name = CrateName::normalize_dashes(&krate);
|
||||||
let prev = crates.insert(crate_name.clone(), crate_id);
|
let prev = crates.insert(crate_name.clone(), crate_id);
|
||||||
assert!(prev.is_none());
|
assert!(prev.is_none());
|
||||||
for dep in meta.deps {
|
for dep in meta.deps {
|
||||||
let dep = CrateName::new(&dep).unwrap();
|
let dep = CrateName::normalize_dashes(&dep);
|
||||||
crate_deps.push((crate_name.clone(), dep))
|
crate_deps.push((crate_name.clone(), dep))
|
||||||
}
|
}
|
||||||
} else if meta.path == "/main.rs" || meta.path == "/lib.rs" {
|
} else if meta.path == "/main.rs" || meta.path == "/lib.rs" {
|
||||||
|
@ -3163,4 +3163,34 @@ fn main() { let s<|>t = test().get(); }
|
|||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn hover_displays_normalized_crate_names() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
//- /lib.rs crate:name-with-dashes
|
||||||
|
pub mod wrapper {
|
||||||
|
pub struct Thing { x: u32 }
|
||||||
|
|
||||||
|
impl Thing {
|
||||||
|
pub fn new() -> Thing { Thing { x: 0 } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- /main.rs crate:main deps:name-with-dashes
|
||||||
|
fn main() { let foo_test = name_with_dashes::wrapper::Thing::new<|>(); }
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
*new*
|
||||||
|
|
||||||
|
```rust
|
||||||
|
name_with_dashes::wrapper::Thing
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
pub fn new() -> Thing
|
||||||
|
```
|
||||||
|
"#]],
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user