Skip to content

Commit

Permalink
move test
Browse files Browse the repository at this point in the history
  • Loading branch information
max-hoffman committed Mar 14, 2024
1 parent 2b2abcb commit 4079f38
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 58 deletions.
8 changes: 4 additions & 4 deletions go/libraries/doltcore/sqle/enginetest/dolt_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2397,23 +2397,23 @@ func TestDiffSystemTablePrepared(t *testing.T) {
}
}

func TestSchemaDiffSystemTable(t *testing.T) {
func TestSchemaDiffTableFunction(t *testing.T) {
harness := newDoltHarness(t)
defer harness.Close()
harness.Setup(setup.MydbData)
for _, test := range SchemaDiffSystemTableScriptTests {
for _, test := range SchemaDiffTableFunctionScriptTests {
harness.engine = nil
t.Run(test.Name, func(t *testing.T) {
enginetest.TestScript(t, harness, test)
})
}
}

func TestSchemaDiffSystemTablePrepared(t *testing.T) {
func TestSchemaDiffTableFunctionPrepared(t *testing.T) {
harness := newDoltHarness(t)
defer harness.Close()
harness.Setup(setup.MydbData)
for _, test := range SchemaDiffSystemTableScriptTests {
for _, test := range SchemaDiffTableFunctionScriptTests {
harness.engine = nil
t.Run(test.Name, func(t *testing.T) {
enginetest.TestScriptPrepared(t, harness, test)
Expand Down
53 changes: 0 additions & 53 deletions go/libraries/doltcore/sqle/enginetest/dolt_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,59 +721,6 @@ var DoltScripts = []queries.ScriptTest{
},
},
},
{
Name: "prepared table functions",
SetUpScript: []string{
"create table t1 (a int primary key)",
"insert into t1 values (0), (1)",
"call dolt_add('.');",
"set @Commit0 = '';",
"call dolt_commit_hash_out(@Commit0, '-am', 'commit 0');",
//
"alter table t1 add column b int default 1",
"call dolt_add('.');",
"set @Commit1 = '';",
"call dolt_commit_hash_out(@Commit1, '-am', 'commit 1');",
//
"create table t2 (a int primary key)",
"insert into t2 values (0), (1)",
"insert into t1 values (2,2), (3,2)",
"call dolt_add('.');",
"set @Commit2 = '';",
"call dolt_commit_hash_out(@Commit2, '-am', 'commit 2');",
//
"prepare sch_diff from 'select count(*) from dolt_schema_diff(?,?,?)'",
"prepare diff_stat from 'select count(*) from dolt_diff_stat(?,?,?)'",
"prepare diff_sum from 'select count(*) from dolt_diff_summary(?,?,?)'",
//"prepare table_diff from 'select * from dolt_diff(?,?,?)'",
"prepare patch from 'select count(*) from dolt_schema_diff(?,?,?)'",
},
Assertions: []queries.ScriptTestAssertion{
{
Query: "set @t1_name = 't1';",
},
{
Query: "execute sch_diff using @Commit0, @Commit1, @t1_name",
Expected: []sql.Row{{1}},
},
{
Query: "execute diff_stat using @Commit1, @Commit2, @t1_name",
Expected: []sql.Row{{1}},
},
{
Query: "execute diff_sum using @Commit1, @Commit2, @t1_name",
Expected: []sql.Row{{1}},
},
//{
// Query: "execute table_diff using @Commit2, @Commit2, @t1_name",
// Expected: []sql.Row{},
//},
{
Query: "execute patch using @Commit0, @Commit1, @t1_name",
Expected: []sql.Row{{1}},
},
},
},
{
Name: "test has_ancestor",
SetUpScript: []string{
Expand Down
55 changes: 54 additions & 1 deletion go/libraries/doltcore/sqle/enginetest/dolt_queries_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -5033,7 +5033,7 @@ var CommitDiffSystemTableScriptTests = []queries.ScriptTest{
},
}

var SchemaDiffSystemTableScriptTests = []queries.ScriptTest{
var SchemaDiffTableFunctionScriptTests = []queries.ScriptTest{
{
Name: "basic schema changes",
SetUpScript: []string{
Expand Down Expand Up @@ -5413,6 +5413,59 @@ var SchemaDiffSystemTableScriptTests = []queries.ScriptTest{
},
},
},
{
Name: "prepared table functions",
SetUpScript: []string{
"create table t1 (a int primary key)",
"insert into t1 values (0), (1)",
"call dolt_add('.');",
"set @Commit0 = '';",
"call dolt_commit_hash_out(@Commit0, '-am', 'commit 0');",
//
"alter table t1 add column b int default 1",
"call dolt_add('.');",
"set @Commit1 = '';",
"call dolt_commit_hash_out(@Commit1, '-am', 'commit 1');",
//
"create table t2 (a int primary key)",
"insert into t2 values (0), (1)",
"insert into t1 values (2,2), (3,2)",
"call dolt_add('.');",
"set @Commit2 = '';",
"call dolt_commit_hash_out(@Commit2, '-am', 'commit 2');",
//
"prepare sch_diff from 'select count(*) from dolt_schema_diff(?,?,?)'",
"prepare diff_stat from 'select count(*) from dolt_diff_stat(?,?,?)'",
"prepare diff_sum from 'select count(*) from dolt_diff_summary(?,?,?)'",
//"prepare table_diff from 'select * from dolt_diff(?,?,?)'",
"prepare patch from 'select count(*) from dolt_schema_diff(?,?,?)'",
},
Assertions: []queries.ScriptTestAssertion{
{
Query: "set @t1_name = 't1';",
},
{
Query: "execute sch_diff using @Commit0, @Commit1, @t1_name",
Expected: []sql.Row{{1}},
},
{
Query: "execute diff_stat using @Commit1, @Commit2, @t1_name",
Expected: []sql.Row{{1}},
},
{
Query: "execute diff_sum using @Commit1, @Commit2, @t1_name",
Expected: []sql.Row{{1}},
},
//{
// Query: "execute table_diff using @Commit2, @Commit2, @t1_name",
// Expected: []sql.Row{},
//},
{
Query: "execute patch using @Commit0, @Commit1, @t1_name",
Expected: []sql.Row{{1}},
},
},
},
}

type systabScript struct {
Expand Down

0 comments on commit 4079f38

Please sign in to comment.