Skip to content

Commit 309c293

Browse files
enums
1 parent 341a0d6 commit 309c293

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

crates/pgt_hover/tests/hover_integration_tests.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ async fn test_grant_table_hover(test_db: PgPool) {
520520
}
521521

522522
#[sqlx::test(migrator = "pgt_test_utils::MIGRATIONS")]
523-
async fn hover_on_types(test_db: PgPool) {
523+
async fn hover_on_composite_type(test_db: PgPool) {
524524
let setup = r#"create type compfoo as (f1 int, f2 text);"#;
525525

526526
let query = format!(
@@ -536,3 +536,15 @@ async fn hover_on_types(test_db: PgPool) {
536536
)
537537
.await;
538538
}
539+
540+
#[sqlx::test(migrator = "pgt_test_utils::MIGRATIONS")]
541+
async fn hover_on_enum_type(test_db: PgPool) {
542+
let setup = r#"create type compfoo as ENUM ('yes', 'no');"#;
543+
544+
let query = format!(
545+
"create function getfoo() returns setof comp{}foo as $$ select fooid, fooname from foo $$ language sql;",
546+
QueryWithCursorPosition::cursor_marker()
547+
);
548+
549+
test_hover_at_cursor("hover_custom_type_enum", query, Some(setup), &test_db).await;
550+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
source: crates/pgt_hover/tests/hover_integration_tests.rs
3+
expression: snapshot
4+
---
5+
# Input
6+
```sql
7+
create function getfoo() returns setof compfoo as $$ select fooid, fooname from foo $$ language sql;
8+
↑ hovered here
9+
```
10+
11+
# Hover Results
12+
### `public.compfoo` (Custom Type)
13+
```plain
14+
Enum Permutations:
15+
- yes
16+
- no
17+
18+
19+
```
20+
---
21+
```plain
22+
23+
24+
```

0 commit comments

Comments
 (0)