Skip to content

Commit 7d2604f

Browse files
committed
Add test case
1 parent acc54c9 commit 7d2604f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/postgres/types.rs

+32
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,38 @@ fn create_2() {
2424
);
2525
}
2626

27+
#[test]
28+
fn create_3() {
29+
assert_eq!(
30+
Type::create()
31+
.as_enum(Tea::Enum)
32+
.values([Tea::EverydayTea, Tea::BreakfastTea])
33+
.to_string(PostgresQueryBuilder),
34+
r#"CREATE TYPE "tea" AS ENUM ('EverydayTea', 'BreakfastTea')"#
35+
);
36+
37+
enum Tea {
38+
Enum,
39+
EverydayTea,
40+
BreakfastTea,
41+
}
42+
43+
impl sea_query::Iden for Tea {
44+
fn unquoted(&self, s: &mut dyn std::fmt::Write) {
45+
write!(
46+
s,
47+
"{}",
48+
match self {
49+
Self::Enum => "tea",
50+
Self::EverydayTea => "EverydayTea",
51+
Self::BreakfastTea => "BreakfastTea",
52+
}
53+
)
54+
.unwrap();
55+
}
56+
}
57+
}
58+
2759
#[test]
2860
fn drop_1() {
2961
assert_eq!(

0 commit comments

Comments
 (0)