(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestWhereCloneCorruption(t *testing.T) { |
| 12 | for whereCount := 1; whereCount <= 8; whereCount++ { |
| 13 | t.Run(fmt.Sprintf("w=%d", whereCount), func(t *testing.T) { |
| 14 | s := new(Statement) |
| 15 | for w := 0; w < whereCount; w++ { |
| 16 | s = s.clone() |
| 17 | s.AddClause(clause.Where{ |
| 18 | Exprs: s.BuildCondition(fmt.Sprintf("where%d", w)), |
| 19 | }) |
| 20 | } |
| 21 | |
| 22 | s1 := s.clone() |
| 23 | s1.AddClause(clause.Where{ |
| 24 | Exprs: s.BuildCondition("FINAL1"), |
| 25 | }) |
| 26 | s2 := s.clone() |
| 27 | s2.AddClause(clause.Where{ |
| 28 | Exprs: s.BuildCondition("FINAL2"), |
| 29 | }) |
| 30 | |
| 31 | if reflect.DeepEqual(s1.Clauses["WHERE"], s2.Clauses["WHERE"]) { |
| 32 | t.Errorf("Where conditions should be different") |
| 33 | } |
| 34 | }) |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | func TestNilCondition(t *testing.T) { |
| 39 | s := new(Statement) |
nothing calls this directly
no test coverage detected