Skip to content

Commit 116026d

Browse files
committed
update tests
1 parent 00882db commit 116026d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

sql/sql_mode_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ import (
2121
)
2222

2323
func TestSqlMode(t *testing.T) {
24-
// Test that ANSI mode includes ANSI_QUOTES mode
25-
sqlMode := NewSqlModeFromString("only_full_group_by,ansi")
24+
// Test that ANSI mode includes ANSI_QUOTES, PIPES_AS_CONCAT, and ONLY_FULL_GROUP_BY mode
25+
sqlMode := NewSqlModeFromString("ansi")
2626
assert.True(t, sqlMode.AnsiQuotes())
2727
assert.True(t, sqlMode.ModeEnabled("ansi"))
2828
assert.True(t, sqlMode.ModeEnabled("ANSI"))
29-
assert.True(t, sqlMode.ModeEnabled("ONLY_FULL_GROUP_BY"))
3029
assert.False(t, sqlMode.ModeEnabled("fake_mode"))
3130
assert.True(t, sqlMode.ParserOptions().AnsiQuotes)
32-
assert.Equal(t, "ANSI,ONLY_FULL_GROUP_BY", sqlMode.String())
33-
assert.False(t, sqlMode.PipesAsConcat())
31+
assert.Equal(t, "ANSI", sqlMode.String())
32+
assert.True(t, sqlMode.PipesAsConcat()) // PIPES_AS_CONCAT is included in ANSI mode
33+
assert.True(t, sqlMode.OnlyFullGroupBy()) // ONLY_FULL_GROUP_BY is included in ANSI mode
3434
assert.False(t, sqlMode.ModeEnabled("pipes_as_concat"))
3535

3636
// Test a mixed case SQL_MODE string where only ANSI_QUOTES is enabled
@@ -44,13 +44,14 @@ func TestSqlMode(t *testing.T) {
4444
assert.False(t, sqlMode.PipesAsConcat())
4545
assert.False(t, sqlMode.ModeEnabled("pipes_as_concat"))
4646

47-
// Test when SQL_MODE does not include ANSI_QUOTES, includes PIPES_AS_CONCAT
47+
// Test when SQL_MODE does not include ANSI_QUOTES, includes PIPES_AS_CONCAT and STRICT_TRANS_TABLES
4848
sqlMode = NewSqlModeFromString("ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,PIPES_AS_CONCAT")
4949
assert.False(t, sqlMode.AnsiQuotes())
5050
assert.True(t, sqlMode.ModeEnabled("STRICT_TRANS_TABLES"))
5151
assert.False(t, sqlMode.ModeEnabled("ansi_quotes"))
5252
assert.False(t, sqlMode.ParserOptions().AnsiQuotes)
5353
assert.True(t, sqlMode.PipesAsConcat())
5454
assert.True(t, sqlMode.ModeEnabled("pipes_as_concat"))
55+
assert.True(t, sqlMode.Strict())
5556
assert.Equal(t, "ONLY_FULL_GROUP_BY,PIPES_AS_CONCAT,STRICT_TRANS_TABLES", sqlMode.String())
5657
}

0 commit comments

Comments
 (0)