Skip to content

Commit e779778

Browse files
committed
Add tests and SQL files for insert conflict formatting
1 parent 57ea031 commit e779778

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/test/kotlin/org/domaframework/doma/intellij/formatter/SqlFormatterTest.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ class SqlFormatterTest : BasePlatformTestCase() {
8484
formatSqlFile("Delete.sql", "Delete_format.sql")
8585
}
8686

87+
fun testInsertConflictUpdateFormatter() {
88+
formatSqlFile("InsertConflictUpdate.sql", "InsertConflictUpdate_format.sql")
89+
}
90+
91+
fun testInsertConflictNothingFormatter() {
92+
formatSqlFile("InsertConflictNothing.sql", "InsertConflictNothing_format.sql")
93+
}
94+
8795
private fun formatSqlFile(
8896
beforeFile: String,
8997
afterFile: String,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
insert into users (username, email)
2+
values ('user', '[email protected]')
3+
on CONFLICT(username) do nothing
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
INSERT INTO users
2+
(username
3+
, email)
4+
VALUES ('user'
5+
6+
ON CONFLICT(username)
7+
DO NOTHING

0 commit comments

Comments
 (0)