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

Code before:
					{"can compare to integer", "decimal tests", "select * from decimals;", "PASS", ""},
					{"should fail", "decimal tests", "select * from decimals;", "FAIL", "Assertion failed: expected_single_value greater than 10.5, got 10.4"},
					{"should pass", "decimal tests", "select * from decimals;", "PASS", ""},
				},
			},
		},
	},
	{
		Name: "Can handle null values correctly",
		SetUpScript: []string{
			"CREATE TABLE numbers (i int, t text)",
			"INSERT INTO numbers VALUES (NULL, NULL)",
			"INSERT INTO dolt_tests (test_name, test_query, assertion_type, assertion_comparator) VALUES " +
				"('simple null int equality', 'SELECT i FROM numbers', 'expected_single_value', '=='), " +
				"('simple null string equality', 'SELECT t FROM numbers', 'expected_single_value', '=='), " +
				"('simple null inequality', 'SELECT i FROM numbers', 'expected_single_value', '!=')",
		},
		Assertions: []queries.ScriptTestAssertion{
			{
				Query: "SELECT * FROM dolt_test_run('*')",
				Expected: []sql.Row{
					{"simple null inequality", "", "SELECT i FROM numbers", "FAIL", "Assertion failed: expected_single_value not equal to NULL, got NULL"},
					{"simple null int equality", "", "SELECT i FROM numbers", "PASS", ""},
					{"simple null string equality", "", "SELECT t FROM numbers", "PASS", ""},
				},
			},
		},
	},
	{
		Name: "Single value will not accept multiple values",
		SetUpScript: []string{
			"CREATE TABLE numbers (i int)",
			"INSERT INTO numbers VALUES (1),(2)",
			"INSERT INTO dolt_tests VALUES ('should fail, many columns', 'not one cell', 'select * from dolt_log;', 'expected_single_value', '==', '0')",
			"INSERT INTO dolt_tests VALUES ('should fail, no rows', 'not one cell', 'show tables like ''invalid'';', 'expected_single_value', '==', '0')",
			"INSERT INTO dolt_tests VALUES ('should fail, many rows', 'not one cell', 'select * from numbers;', 'expected_single_value', '==', '0')",
		},
		Assertions: []queries.ScriptTestAssertion{
			{
				Query: "SELECT * FROM dolt_test_run('not one cell')",
				Expected: []sql.Row{
					{"should fail, many columns", "not one cell", "select * from dolt_log;", "FAIL", "expected_single_value expects exactly one cell. Received multiple columns"},
					{"should fail, many rows", "not one cell", "select * from numbers;", "FAIL", "expected_single_value expects exactly one cell. Received multiple rows"},
					{"should fail, no rows", "not one cell", "show tables like 'invalid';", "FAIL", "expected_single_value expects exactly one cell. Received 0 rows"},
				},
			},
		},
	},
	{
		Name: "Can run dolt unit tests on each comparison type",
		SetUpScript: []string{

Review comment (bug):
Looks like you are missing a test where you are looking for a NULL value, but the test return fails. Would be good to ensure the message is correct.

Code after:
					{"can compare to integer", "decimal tests", "select * from decimals;", "PASS", ""},
					{"should fail", "decimal tests", "select * from decimals;", "FAIL", "Assertion failed: expected_single_value greater than 10.5, got 10.4"},
					{"should pass", "decimal tests", "select * from decimals;", "PASS", ""},
				},
			},
		},
	},
	{
		Name: "Can handle null values correctly",
		SetUpScript: []string{
			"CREATE TABLE numbers (i int, t text, j int)",
			"INSERT INTO numbers VALUES (NULL, NULL, 4)",
			"INSERT INTO dolt_tests (test_name, test_query, assertion_type, assertion_comparator) VALUES " +
				"('simple null int equality', 'SELECT i FROM numbers', 'expected_single_value', '=='), " +
				"('simple null string equality', 'SELECT t FROM numbers', 'expected_single_value', '=='), " +
				"('simple null inequality', 'SELECT i FROM numbers', 'expected_single_value', '!='), " +
				"('expect null, get not null', 'SELECT j FROM numbers', 'expected_single_value', '==')",
		},
		Assertions: []queries.ScriptTestAssertion{
			{
				Query: "SELECT * FROM dolt_test_run('*')",
				Expected: []sql.Row{
					{"expect null, get not null", "", "SELECT j FROM numbers", "FAIL", "Assertion failed: expected_single_value equal to NULL, got 4"},
					{"simple null inequality", "", "SELECT i FROM numbers", "FAIL", "Assertion failed: expected_single_value not equal to NULL, got NULL"},
					{"simple null int equality", "", "SELECT i FROM numbers", "PASS", ""},
					{"simple null string equality", "", "SELECT t FROM numbers", "PASS", ""},
				},
			},
		},
	},
	{
		Name: "Single value will not accept multiple values",
		SetUpScript: []string{
			"CREATE TABLE numbers (i int)",
			"INSERT INTO numbers VALUES (1),(2)",
			"INSERT INTO dolt_tests VALUES ('should fail, many columns', 'not one cell', 'select * from dolt_log;', 'expected_single_value', '==', '0')",
			"INSERT INTO dolt_tests VALUES ('should fail, no rows', 'not one cell', 'show tables like ''invalid'';', 'expected_single_value', '==', '0')",
			"INSERT INTO dolt_tests VALUES ('should fail, many rows', 'not one cell', 'select * from numbers;', 'expected_single_value', '==', '0')",
		},
		Assertions: []queries.ScriptTestAssertion{
			{
				Query: "SELECT * FROM dolt_test_run('not one cell')",
				Expected: []sql.Row{
					{"should fail, many columns", "not one cell", "select * from dolt_log;", "FAIL", "expected_single_value expects exactly one cell. Received multiple columns"},
					{"should fail, many rows", "not one cell", "select * from numbers;", "FAIL", "expected_single_value expects exactly one cell. Received multiple rows"},
					{"should fail, no rows", "not one cell", "show tables like 'invalid';", "FAIL", "expected_single_value expects exactly one cell. Received 0 rows"},
				},
			},
		},
	},
	{