(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestPlugin_RecordsTableName(t *testing.T) { |
| 68 | db := openTestDB(t) |
| 69 | plugin := gosqlxgorm.NewPlugin() |
| 70 | _ = db.Use(plugin) |
| 71 | |
| 72 | var users []User |
| 73 | db.Where("name = ?", "alice").Find(&users) |
| 74 | |
| 75 | stats := plugin.Stats() |
| 76 | found := false |
| 77 | for _, q := range stats.Queries { |
| 78 | for _, tbl := range q.Tables { |
| 79 | if tbl == "users" { |
| 80 | found = true |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | if !found { |
| 85 | t.Errorf("expected 'users' in recorded table names; got %+v", stats.Queries) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | func TestPlugin_ParseErrorDoesNotPanic(t *testing.T) { |
| 90 | db := openTestDB(t) |
nothing calls this directly
no test coverage detected