Skip to content

Commit 0936f9d

Browse files
committed
New test method
1 parent 42b926d commit 0936f9d

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

enginetest/enginetests.go

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5480,26 +5480,12 @@ func TestAlterTable(t *testing.T, harness Harness) {
54805480
},
54815481
}, checks)
54825482
})
5483-
5484-
t.Run("ALTER TABLE modify with AUTO_INCREMENT", func(t *testing.T) {
5485-
RunQuery(t, e, harness, "CREATE TABLE t40 (pk int AUTO_INCREMENT PRIMARY KEY, val int)")
5486-
RunQuery(t, e, harness, "INSERT into t40 VALUES (1, 1), (NULL, 2), (NULL, 3)")
5487-
5488-
RunQuery(t, e, harness, "ALTER TABLE t40 MODIFY COLUMN pk int")
5489-
ctx := harness.NewContext()
5490-
TestQueryWithContext(t, ctx, e, harness, "DESCRIBE t40", []sql.Row{
5491-
{"pk", "int", "NO", "PRI", "NULL", ""},
5492-
{"val", "int", "YES", "", "NULL", ""}},
5493-
nil, nil)
5494-
5495-
AssertErr(t, e, harness, "INSERT INTO t40 VALUES (NULL, 4)", sql.ErrInsertIntoNonNullableProvidedNull)
5496-
RunQuery(t, e, harness, "DROP TABLE t40")
5497-
5498-
RunQuery(t, e, harness, "CREATE TABLE t40 (pk int AUTO_INCREMENT PRIMARY KEY, val int)")
5499-
RunQuery(t, e, harness, "INSERT into t40 VALUES (NULL, 1)")
5483+
}
55005484

5501-
TestQueryWithContext(t, ctx, e, harness, "SELECT * FROM t40", []sql.Row{{1, 1}}, nil, nil)
5502-
})
5485+
func TestAlterTableScripts(t *testing.T, harness Harness) {
5486+
for _, script := range queries.AlterTableScripts {
5487+
TestScript(t, harness, script)
5488+
}
55035489
}
55045490

55055491
func NewColumnDefaultValue(expr sql.Expression, outType sql.Type, representsLiteral, isParenthesized, mayReturnNil bool) *sql.ColumnDefaultValue {

enginetest/memory_engine_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,7 @@ func TestAlterTable(t *testing.T) {
839839
}
840840

841841
func TestAlterTableScripts(t *testing.T) {
842-
for _, script := range queries.AlterTableScripts {
843-
enginetest.TestScript(t, enginetest.NewDefaultMemoryHarness(), script)
844-
}
842+
enginetest.TestAlterTableScripts(t, enginetest.NewDefaultMemoryHarness())
845843
}
846844

847845
func TestDateParse(t *testing.T) {

0 commit comments

Comments
 (0)