Skip to content

Commit 3181857

Browse files
committed
add doc link test for goto def
Signed-off-by: Hayashi Mikihiro <[email protected]>
1 parent 778322e commit 3181857

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

crates/ide/src/goto_definition.rs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,74 @@ pub fn foo() { }
19221922
)
19231923
}
19241924

1925+
#[test]
1926+
fn goto_def_for_intra_doc_link_outer_same_file() {
1927+
check(
1928+
r#"
1929+
/// [`S$0`]
1930+
mod m {
1931+
//! [`super::S`]
1932+
}
1933+
struct S;
1934+
//^
1935+
"#,
1936+
);
1937+
1938+
check(
1939+
r#"
1940+
/// [`S$0`]
1941+
mod m {}
1942+
struct S;
1943+
//^
1944+
"#,
1945+
);
1946+
1947+
check(
1948+
r#"
1949+
/// [`S$0`]
1950+
fn f() {
1951+
//! [`S`]
1952+
}
1953+
struct S;
1954+
//^
1955+
"#,
1956+
);
1957+
}
1958+
1959+
#[test]
1960+
fn goto_def_for_intra_doc_link_inner_same_file() {
1961+
check(
1962+
r#"
1963+
/// [`S`]
1964+
mod m {
1965+
//! [`super::S$0`]
1966+
}
1967+
struct S;
1968+
//^
1969+
"#,
1970+
);
1971+
1972+
check(
1973+
r#"
1974+
mod m {
1975+
//! [`super::S$0`]
1976+
}
1977+
struct S;
1978+
//^
1979+
"#,
1980+
);
1981+
1982+
check(
1983+
r#"
1984+
fn f() {
1985+
//! [`S$0`]
1986+
}
1987+
struct S;
1988+
//^
1989+
"#,
1990+
);
1991+
}
1992+
19251993
#[test]
19261994
fn goto_def_for_intra_doc_link_inner() {
19271995
check(

0 commit comments

Comments
 (0)