Unit tests cleanup.
This commit is contained in:
parent
52bdd4b59f
commit
3c4b078941
8 changed files with 150 additions and 179 deletions
|
|
@ -1,76 +1,42 @@
|
|||
package sqlbuilder
|
||||
|
||||
import (
|
||||
"gotest.tools/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestStringEQColumn(t *testing.T) {
|
||||
func TestStringEQ(t *testing.T) {
|
||||
exp := table3StrCol.EQ(table2ColStr)
|
||||
|
||||
out := queryData{}
|
||||
err := exp.serialize(select_statement, &out)
|
||||
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, out.buff.String(), "(table3.col2 = table2.colStr)")
|
||||
}
|
||||
|
||||
func TestStringEQString(t *testing.T) {
|
||||
exp := table3StrCol.EQ(String("JOHN"))
|
||||
|
||||
out := queryData{}
|
||||
err := exp.serialize(select_statement, &out)
|
||||
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, out.buff.String(), "(table3.col2 = $1)")
|
||||
assertExpressionSerialize(t, exp, "(table3.col2 = table2.colStr)")
|
||||
exp = table3StrCol.EQ(String("JOHN"))
|
||||
assertExpressionSerialize(t, exp, "(table3.col2 = $1)", "JOHN")
|
||||
}
|
||||
|
||||
func TestStringNOT_EQ(t *testing.T) {
|
||||
exp := table3StrCol.NOT_EQ(table2ColStr)
|
||||
|
||||
out := queryData{}
|
||||
err := exp.serialize(select_statement, &out)
|
||||
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, out.buff.String(), "(table3.col2 != table2.colStr)")
|
||||
assertExpressionSerialize(t, exp, "(table3.col2 != table2.colStr)")
|
||||
assertExpressionSerialize(t, table3StrCol.NOT_EQ(String("JOHN")), "(table3.col2 != $1)", "JOHN")
|
||||
}
|
||||
|
||||
func TestStringGT(t *testing.T) {
|
||||
exp := table3StrCol.GT(table2ColStr)
|
||||
|
||||
out := queryData{}
|
||||
err := exp.serialize(select_statement, &out)
|
||||
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, out.buff.String(), "(table3.col2 > table2.colStr)")
|
||||
assertExpressionSerialize(t, exp, "(table3.col2 > table2.colStr)")
|
||||
assertExpressionSerialize(t, table3StrCol.GT(String("JOHN")), "(table3.col2 > $1)", "JOHN")
|
||||
}
|
||||
|
||||
func TestStringGT_EQ(t *testing.T) {
|
||||
exp := table3StrCol.GT_EQ(table2ColStr)
|
||||
|
||||
out := queryData{}
|
||||
err := exp.serialize(select_statement, &out)
|
||||
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, out.buff.String(), "(table3.col2 >= table2.colStr)")
|
||||
assertExpressionSerialize(t, exp, "(table3.col2 >= table2.colStr)")
|
||||
assertExpressionSerialize(t, table3StrCol.GT_EQ(String("JOHN")), "(table3.col2 >= $1)", "JOHN")
|
||||
}
|
||||
|
||||
func TestStringLT(t *testing.T) {
|
||||
exp := table3StrCol.LT(table2ColStr)
|
||||
|
||||
out := queryData{}
|
||||
err := exp.serialize(select_statement, &out)
|
||||
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, out.buff.String(), "(table3.col2 < table2.colStr)")
|
||||
assertExpressionSerialize(t, exp, "(table3.col2 < table2.colStr)")
|
||||
assertExpressionSerialize(t, table3StrCol.LT(String("JOHN")), "(table3.col2 < $1)", "JOHN")
|
||||
}
|
||||
|
||||
func TestStringLT_EQ(t *testing.T) {
|
||||
exp := table3StrCol.LT_EQ(table2ColStr)
|
||||
|
||||
out := queryData{}
|
||||
err := exp.serialize(select_statement, &out)
|
||||
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, out.buff.String(), "(table3.col2 <= table2.colStr)")
|
||||
assertExpressionSerialize(t, exp, "(table3.col2 <= table2.colStr)")
|
||||
assertExpressionSerialize(t, table3StrCol.LT_EQ(String("JOHN")), "(table3.col2 <= $1)", "JOHN")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue