Repository: dolthub/dolt
File: go/libraries/doltcore/sqle/enginetest/dolt_queries.go (Go)

Code before:
				ExpectedErrStr: "'feature' could be both a local table and a tracking branch.\nPlease use -- to disambiguate.",
			},
			{
				Query:    "call dolt_checkout('feature', '--');",
				Expected: []sql.Row{{0, "Switched to branch 'feature'\nbranch 'feature' set up to track 'origin/feature'."}},
			},
			{
				Query:    "select active_branch();",
				Expected: []sql.Row{{"feature"}},
			},
			{
				Query:    "select * from feature order by id;",
				Expected: []sql.Row{{1, 100}, {2, 200}},
			},
		},
	},
	{
		Name: "dolt_checkout multiple tables with one missing",
		SetUpScript: []string{
			"create table t1 (pk int primary key, c int);",
			"call dolt_commit('-Am', 'created table');",
			"insert into t1 values (1,1);",
			"call dolt_commit('-am', 'add row');",
			"insert into t1 values (2,2);",
		},
		Assertions: []queries.ScriptTestAssertion{
			{
				Query:          "call dolt_checkout('t1', 'missing');",
				ExpectedErrStr: "error: tablespec 'missing' did not match any table(s) known to dolt",
			},
			{
				Query:    "select * from t1 order by 1;",
				Expected: []sql.Row{{1, 1}},
			},
			{
				Query:          "call dolt_checkout('t1', 'missing', 'missing2');",
				ExpectedErrStr: "error: tablespec 'missing' did not match any table(s) known to dolt\nerror: tablespec 'missing2' did not match any table(s) known to dolt",
			},
		},
	},
}

var DoltCheckoutReadOnlyScripts = []queries.ScriptTest{
	{
		Name: "dolt checkout -b returns an error for read-only databases",
		Assertions: []queries.ScriptTestAssertion{
			{
				Query:          "call dolt_checkout('-b', 'newBranch');",
				ExpectedErrStr: "unable to create new branch in a read-only database",
			},
		},

Review comment (suggestion):
Also provide a test with the missing tablespec in the front of the tables list, e.g., `dolt checkout missing t1 missing2`. You'll have to use `--` operator at the moment to disambiguate since Dolt isn't defaulting to tablespec but finding the branch instead.

Code after:
				ExpectedErrStr: "'feature' could be both a local table and a tracking branch.\nPlease use -- to disambiguate.",
			},
			{
				Query:    "call dolt_checkout('feature', '--');",
				Expected: []sql.Row{{0, "Switched to branch 'feature'\nbranch 'feature' set up to track 'origin/feature'."}},
			},
			{
				Query:    "select active_branch();",
				Expected: []sql.Row{{"feature"}},
			},
			{
				Query:    "select * from feature order by id;",
				Expected: []sql.Row{{1, 100}, {2, 200}},
			},
		},
	},
	{
		Name: "dolt_checkout multiple tables with one missing",
		SetUpScript: []string{
			"create table t1 (pk int primary key, c int);",
			"call dolt_commit('-Am', 'created table');",
			"insert into t1 values (1,1);",
			"call dolt_commit('-am', 'add row');",
			"insert into t1 values (2,2);",
		},
		Assertions: []queries.ScriptTestAssertion{
			{
				Query:          "call dolt_checkout('t1', 'missing');",
				ExpectedErrStr: "error: tablespec 'missing' did not match any table(s) known to dolt",
			},
			{
				Query:    "select * from t1 order by 1;",
				Expected: []sql.Row{{1, 1}},
			},
			{
				Query:          "call dolt_checkout('t1', 'missing', 'missing2');",
				ExpectedErrStr: "error: tablespec 'missing' did not match any table(s) known to dolt\nerror: tablespec 'missing2' did not match any table(s) known to dolt",
			},
			{
				Query:          "call dolt_checkout('--', 'missing', 't1', 'missing2');",
				ExpectedErrStr: "error: tablespec 'missing' did not match any table(s) known to dolt\nerror: tablespec 'missing2' did not match any table(s) known to dolt",
			},
		},
	},
}

var DoltCheckoutReadOnlyScripts = []queries.ScriptTest{
	{
		Name: "dolt checkout -b returns an error for read-only databases",
		Assertions: []queries.ScriptTestAssertion{
			{