Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Jan 27, 2024
1 parent acc54c9 commit 7d2604f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/postgres/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,38 @@ fn create_2() {
);
}

#[test]
fn create_3() {
assert_eq!(
Type::create()
.as_enum(Tea::Enum)
.values([Tea::EverydayTea, Tea::BreakfastTea])
.to_string(PostgresQueryBuilder),
r#"CREATE TYPE "tea" AS ENUM ('EverydayTea', 'BreakfastTea')"#
);

enum Tea {
Enum,
EverydayTea,
BreakfastTea,
}

impl sea_query::Iden for Tea {
fn unquoted(&self, s: &mut dyn std::fmt::Write) {
write!(
s,
"{}",
match self {
Self::Enum => "tea",
Self::EverydayTea => "EverydayTea",
Self::BreakfastTea => "BreakfastTea",
}
)
.unwrap();
}
}
}

#[test]
fn drop_1() {
assert_eq!(
Expand Down

0 comments on commit 7d2604f

Please sign in to comment.