(t *testing.T)
| 757 | } |
| 758 | |
| 759 | func TestValuerWithValidation(t *testing.T) { |
| 760 | runTestsParallel(t, dsn, func(dbt *DBTest, tbl string) { |
| 761 | in := testValuerWithValidation{"a_value"} |
| 762 | var out string |
| 763 | var rows *sql.Rows |
| 764 | |
| 765 | dbt.mustExec("CREATE TABLE " + tbl + " (value VARCHAR(255)) CHARACTER SET utf8") |
| 766 | dbt.mustExec("INSERT INTO "+tbl+" VALUES (?)", in) |
| 767 | |
| 768 | rows = dbt.mustQuery("SELECT value FROM " + tbl) |
| 769 | defer rows.Close() |
| 770 | |
| 771 | if rows.Next() { |
| 772 | rows.Scan(&out) |
| 773 | if in.value != out { |
| 774 | dbt.Errorf("Valuer: %v != %s", in, out) |
| 775 | } |
| 776 | } else { |
| 777 | dbt.Errorf("Valuer: no data") |
| 778 | } |
| 779 | |
| 780 | if _, err := dbt.db.Exec("INSERT INTO "+tbl+" VALUES (?)", testValuerWithValidation{""}); err == nil { |
| 781 | dbt.Errorf("Failed to check valuer error") |
| 782 | } |
| 783 | |
| 784 | if _, err := dbt.db.Exec("INSERT INTO "+tbl+" VALUES (?)", nil); err != nil { |
| 785 | dbt.Errorf("Failed to check nil") |
| 786 | } |
| 787 | |
| 788 | if _, err := dbt.db.Exec("INSERT INTO "+tbl+" VALUES (?)", map[string]bool{}); err == nil { |
| 789 | dbt.Errorf("Failed to check not valuer") |
| 790 | } |
| 791 | }) |
| 792 | } |
| 793 | |
| 794 | type timeTests struct { |
| 795 | dbtype string |
nothing calls this directly
no test coverage detected
searching dependent graphs…