Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
ascandone committed Sep 20, 2024
1 parent a3af907 commit 2e4409f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions compiler-core/src/language_server/tests/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -947,3 +947,21 @@ pub fn main() {
.unwrap();
insta::assert_debug_snapshot!(hover);
}

#[test]
fn hover_type_alias() {
let code = "
import html/internal
pub type AliasedAttr = internal.Attribute
pub fn checked() -> AliasedAttr {
internal.Attribute
}
";

assert_hover!(
TestProject::for_source(code)
.add_module("html/internal", "pub type Attribute { Attribute }"),
find_position_of("checked").under_last_char()
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
source: compiler-core/src/language_server/tests/hover.rs
expression: "\nimport html/internal\npub type AliasedAttr = internal.Attribute\n\npub fn checked() -> AliasedAttr {\n internal.Attribute\n}\n"
---
import html/internal
pub type AliasedAttr = internal.Attribute

pub fn checked() -> AliasedAttr {
▔▔▔▔▔▔▔▔▔▔▔▔▔↑▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
internal.Attribute
}


----- Hover content -----
Scalar(
String(
"```gleam\nfn() -> html/internal.Attribute\n```\n",
),
)

0 comments on commit 2e4409f

Please sign in to comment.