Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 92ab81b

Browse files
authored
Added LIKE test with newlines (#820)
Added LIKE test with newlines
2 parents a478e1e + f41ff11 commit 92ab81b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Diff for: engine_test.go

+32
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ var queries = []struct {
700700
{"bigtable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
701701
{"floattable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
702702
{"niltable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
703+
{"newlinetable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
703704
{"typestable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
704705
},
705706
},
@@ -711,6 +712,7 @@ var queries = []struct {
711712
{"bigtable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
712713
{"floattable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
713714
{"niltable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
715+
{"newlinetable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
714716
{"typestable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
715717
},
716718
},
@@ -854,6 +856,7 @@ var queries = []struct {
854856
{"bigtable"},
855857
{"floattable"},
856858
{"niltable"},
859+
{"newlinetable"},
857860
{"typestable"},
858861
},
859862
},
@@ -1003,6 +1006,7 @@ var queries = []struct {
10031006
{"bigtable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
10041007
{"floattable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
10051008
{"niltable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
1009+
{"newlinetable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
10061010
{"typestable", "InnoDB", "10", "Fixed", int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), nil, nil, nil, "utf8_bin", nil, nil},
10071011
},
10081012
},
@@ -1117,6 +1121,7 @@ var queries = []struct {
11171121
{"bigtable"},
11181122
{"floattable"},
11191123
{"niltable"},
1124+
{"newlinetable"},
11201125
{"typestable"},
11211126
},
11221127
},
@@ -1129,6 +1134,7 @@ var queries = []struct {
11291134
{"bigtable", "BASE TABLE"},
11301135
{"floattable", "BASE TABLE"},
11311136
{"niltable", "BASE TABLE"},
1137+
{"newlinetable", "BASE TABLE"},
11321138
{"typestable", "BASE TABLE"},
11331139
},
11341140
},
@@ -1146,6 +1152,7 @@ var queries = []struct {
11461152
{"bigtable"},
11471153
{"floattable"},
11481154
{"niltable"},
1155+
{"newlinetable"},
11491156
{"typestable"},
11501157
},
11511158
},
@@ -1531,6 +1538,16 @@ var queries = []struct {
15311538
`SELECT REGEXP_MATCHES("", "", NULL)`,
15321539
[]sql.Row{{nil}},
15331540
},
1541+
{
1542+
"SELECT * FROM newlinetable WHERE s LIKE '%text%'",
1543+
[]sql.Row{
1544+
{int64(1), "\nthere is some text in here"},
1545+
{int64(2), "there is some\ntext in here"},
1546+
{int64(3), "there is some text\nin here"},
1547+
{int64(4), "there is some text in here\n"},
1548+
{int64(5), "there is some text in here"},
1549+
},
1550+
},
15341551
}
15351552

15361553
func TestQueries(t *testing.T) {
@@ -2372,6 +2389,20 @@ func newEngineWithParallelism(t *testing.T, parallelism int) *sqle.Engine {
23722389
sql.NewRow(nil, nil, nil),
23732390
)
23742391

2392+
newlineTable := memory.NewPartitionedTable("newlinetable", sql.Schema{
2393+
{Name: "i", Type: sql.Int64, Source: "newlinetable"},
2394+
{Name: "s", Type: sql.Text, Source: "newlinetable"},
2395+
}, testNumPartitions)
2396+
2397+
insertRows(
2398+
t, newlineTable,
2399+
sql.NewRow(int64(1), "\nthere is some text in here"),
2400+
sql.NewRow(int64(2), "there is some\ntext in here"),
2401+
sql.NewRow(int64(3), "there is some text\nin here"),
2402+
sql.NewRow(int64(4), "there is some text in here\n"),
2403+
sql.NewRow(int64(5), "there is some text in here"),
2404+
)
2405+
23752406
typestable := memory.NewPartitionedTable("typestable", sql.Schema{
23762407
{Name: "id", Type: sql.Int64, Source: "typestable"},
23772408
{Name: "i8", Type: sql.Int8, Source: "typestable", Nullable: true},
@@ -2399,6 +2430,7 @@ func newEngineWithParallelism(t *testing.T, parallelism int) *sqle.Engine {
23992430
db.AddTable("bigtable", bigtable)
24002431
db.AddTable("floattable", floatTable)
24012432
db.AddTable("niltable", nilTable)
2433+
db.AddTable("newlinetable", newlineTable)
24022434
db.AddTable("typestable", typestable)
24032435

24042436
db2 := memory.NewDatabase("foo")

0 commit comments

Comments
 (0)