─── FormatAST ───────────────────────────────────────────────────────────────
(t *testing.T)
| 1033 | // ─── FormatAST ─────────────────────────────────────────────────────────────── |
| 1034 | |
| 1035 | func TestFormatAST_MultiStatement(t *testing.T) { |
| 1036 | a := &ast.AST{ |
| 1037 | Statements: []ast.Statement{ |
| 1038 | &ast.SelectStatement{ |
| 1039 | Columns: []ast.Expression{&ast.Identifier{Name: "a"}}, |
| 1040 | From: []ast.TableReference{{Name: "t1"}}, |
| 1041 | }, |
| 1042 | &ast.SelectStatement{ |
| 1043 | Columns: []ast.Expression{&ast.Identifier{Name: "b"}}, |
| 1044 | From: []ast.TableReference{{Name: "t2"}}, |
| 1045 | }, |
| 1046 | }, |
| 1047 | } |
| 1048 | |
| 1049 | result := formatter.FormatAST(a, ast.CompactStyle()) |
| 1050 | if !strings.Contains(result, "SELECT a FROM t1") { |
| 1051 | t.Errorf("should contain first statement, got: %s", result) |
| 1052 | } |
| 1053 | if !strings.Contains(result, "SELECT b FROM t2") { |
| 1054 | t.Errorf("should contain second statement, got: %s", result) |
| 1055 | } |
| 1056 | } |
| 1057 | |
| 1058 | func TestFormatAST_Nil(t *testing.T) { |
| 1059 | result := formatter.FormatAST(nil, ast.CompactStyle()) |
nothing calls this directly
no test coverage detected