Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 2024e01

Browse files
committed
Compare without white characters
1 parent 78b4230 commit 2024e01

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

platform/parsers/elastic_query_dsl/pancake_sql_query_generation_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,20 @@ import (
1515
"github.com/stretchr/testify/assert"
1616
"strings"
1717
"testing"
18+
"unicode"
1819
)
1920

2021
const TableName = model.SingleTableNamePlaceHolder
2122

23+
func removeAllWhitespace(s string) string {
24+
result := make([]rune, 0, len(s))
25+
for _, r := range s {
26+
if !unicode.IsSpace(r) {
27+
result = append(result, r)
28+
}
29+
}
30+
return string(result)
31+
}
2232
func TestPancakeQueryGeneration(t *testing.T) {
2333

2434
// logger.InitSimpleLoggerForTestsWarnLevel()
@@ -107,8 +117,8 @@ func TestPancakeQueryGeneration(t *testing.T) {
107117
}
108118
prettyExpectedSql := util.SqlPrettyPrint([]byte(strings.TrimSpace(expectedSql)))
109119

110-
util.AssertSqlEqual(t, prettyExpectedSql, prettyPancakeSql)
111-
120+
//util.AssertSqlEqual(t, prettyExpectedSql, prettyExpectedSql)
121+
assert.Equal(t, removeAllWhitespace(prettyPancakeSql), removeAllWhitespace(prettyExpectedSql))
112122
_, ok := pancakeSql.Type.(PancakeQueryType)
113123
if !ok {
114124
assert.Fail(t, "Expected pancake query type")

0 commit comments

Comments
 (0)