(t *testing.T)
| 99 | } |
| 100 | |
| 101 | func TestPlugin_MaxHistory(t *testing.T) { |
| 102 | db := openTestDB(t) |
| 103 | plugin := gosqlxgorm.NewPluginWithOptions(gosqlxgorm.PluginOptions{ |
| 104 | MaxHistory: 5, |
| 105 | }) |
| 106 | _ = db.Use(plugin) |
| 107 | |
| 108 | // Execute more queries than the limit. |
| 109 | for i := 0; i < 10; i++ { |
| 110 | var users []User |
| 111 | db.Find(&users) |
| 112 | } |
| 113 | |
| 114 | stats := plugin.Stats() |
| 115 | if stats.TotalQueries > 5 { |
| 116 | t.Errorf("expected at most 5 queries, got %d", stats.TotalQueries) |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | func TestPlugin_OnParseError(t *testing.T) { |
| 121 | var called bool |
nothing calls this directly
no test coverage detected