Skip to content

Commit 25e8634

Browse files
committed
Removed test functions and will move to separate files later.
1 parent 9c1208b commit 25e8634

File tree

3 files changed

+0
-96
lines changed

3 files changed

+0
-96
lines changed

tests/connection_test.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -273,21 +273,3 @@ func TestConnectionPing(t *testing.T) {
273273
t.Errorf("Database ping with context failed: %v", err)
274274
}
275275
}
276-
277-
func TestIntervalYearToMonth(t *testing.T) {
278-
var result string
279-
err := DB.Raw("SELECT INTERVAL '2-3' YEAR TO MONTH FROM dual").Scan(&result).Error
280-
if err != nil {
281-
t.Errorf("Year to Month interval query failed: %v", err)
282-
}
283-
t.Logf("Year to Month interval result: %s", result)
284-
}
285-
286-
func TestIntervalDayToSecond(t *testing.T) {
287-
var result string
288-
err := DB.Raw("SELECT INTERVAL '4 5:12:10.222' DAY TO SECOND FROM dual").Scan(&result).Error
289-
if err != nil {
290-
t.Errorf("Day to Second interval query failed: %v", err)
291-
}
292-
t.Logf("Day to Second interval result: %s", result)
293-
}

tests/passed-tests.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ TestPluginCallbacks
3838
TestCallbacksGet
3939
TestCallbacksRemove
4040
TestWithSingleConnection
41-
TestTransactionCommit
42-
TestTransactionRollback
4341
TestConnectionAfterError
4442
TestConnectionWithInvalidQuery
4543
TestMultipleSequentialConnections
@@ -50,8 +48,6 @@ TestContextTimeout
5048
TestLargeResultSet
5149
TestSessionInfo
5250
TestConnectionPing
53-
TestIntervalYearToMonth
54-
TestIntervalDayToSecond
5551
TestConnectionPoolStats
5652
TestPoolValidSettings
5753
TestPoolInvalidSettings

tests/transaction_test.go

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -689,77 +689,3 @@ func TestTransactionWithRawSQL(t *testing.T) {
689689
t.Errorf("Expected age %d, got %d", user.Age+1, result.Age)
690690
}
691691
}
692-
693-
func TestTransactionCommit(t *testing.T) {
694-
// Create test table
695-
type TestTxTable struct {
696-
ID uint `gorm:"primaryKey"`
697-
Name string `gorm:"size:100;column:name"`
698-
}
699-
700-
err := DB.AutoMigrate(&TestTxTable{})
701-
if err != nil {
702-
t.Fatalf("Failed to migrate test table: %v", err)
703-
}
704-
defer DB.Migrator().DropTable(&TestTxTable{})
705-
706-
tx := DB.Begin()
707-
if tx.Error != nil {
708-
t.Fatalf("Failed to begin transaction: %v", tx.Error)
709-
}
710-
711-
record := TestTxTable{Name: "test_commit"}
712-
if err := tx.Create(&record).Error; err != nil {
713-
t.Errorf("Failed to create record in transaction: %v", err)
714-
}
715-
716-
if err := tx.Commit().Error; err != nil {
717-
t.Errorf("Failed to commit transaction: %v", err)
718-
}
719-
720-
// Verify record exists using quoted column name
721-
var count int64
722-
if err := DB.Model(&TestTxTable{}).Where("\"name\" = ?", "test_commit").Count(&count).Error; err != nil {
723-
t.Errorf("Failed to count records: %v", err)
724-
}
725-
if count != 1 {
726-
t.Errorf("Expected 1 record after commit, got %d", count)
727-
}
728-
}
729-
730-
func TestTransactionRollback(t *testing.T) {
731-
// Create test table
732-
type TestTxTable struct {
733-
ID uint `gorm:"primaryKey"`
734-
Name string `gorm:"size:100;column:name"`
735-
}
736-
737-
err := DB.AutoMigrate(&TestTxTable{})
738-
if err != nil {
739-
t.Fatalf("Failed to migrate test table: %v", err)
740-
}
741-
defer DB.Migrator().DropTable(&TestTxTable{})
742-
743-
tx := DB.Begin()
744-
if tx.Error != nil {
745-
t.Fatalf("Failed to begin transaction: %v", tx.Error)
746-
}
747-
748-
record := TestTxTable{Name: "test_rollback"}
749-
if err := tx.Create(&record).Error; err != nil {
750-
t.Errorf("Failed to create record in transaction: %v", err)
751-
}
752-
753-
if err := tx.Rollback().Error; err != nil {
754-
t.Errorf("Failed to rollback transaction: %v", err)
755-
}
756-
757-
// Verify record doesn't exist using quoted column name
758-
var count int64
759-
if err := DB.Model(&TestTxTable{}).Where("\"name\" = ?", "test_rollback").Count(&count).Error; err != nil {
760-
t.Errorf("Failed to count records: %v", err)
761-
}
762-
if count != 0 {
763-
t.Errorf("Expected 0 records after rollback, got %d", count)
764-
}
765-
}

0 commit comments

Comments
 (0)