(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func TestPlainStructUpdate(t *testing.T) { |
| 119 | |
| 120 | db := getLanguagesDb() |
| 121 | |
| 122 | var lastId int64 |
| 123 | if res, err := db.Exec("INSERT INTO languages (name, version, dt_release) VALUES ('Scala', '2.11.7', '2015-06-23')"); err != nil { |
| 124 | t.Fatalf("Sqlite Exec failed: %s", err) |
| 125 | } else if lastId, err = res.LastInsertId(); err != nil { |
| 126 | t.Fatalf("Sqlite LastInsertId failed: %s", err) |
| 127 | } |
| 128 | |
| 129 | l := &Language{ |
| 130 | Id: lastId, |
| 131 | Name: "Go", |
| 132 | Version: "1.4", |
| 133 | DtRelease: time.Date(2014, time.June, 18, 0, 0, 0, 0, time.UTC)} |
| 134 | |
| 135 | l.Recorder = New(squirrel.NewStmtCacheProxy(db), "mysql").Bind("languages", l) |
| 136 | if err := l.Update(); err != nil { |
| 137 | t.Fatalf("Failed Update: %s", err) |
| 138 | } |
| 139 | |
| 140 | lsql := new(Language) |
| 141 | lsql.loadFromSql(lastId, db) |
| 142 | if !l.equals(lsql) { |
| 143 | t.Fatal("Loaded and updated objects should be equivalent") |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | func TestPlainStructDelete(t *testing.T) { |
| 148 |
nothing calls this directly
no test coverage detected