Skip to content

Commit a41f1c7

Browse files
committed
normalize
1 parent a039461 commit a41f1c7

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
+--------------+----------------------------------------+
2-
| info_name| info_value|
3-
+--------------+----------------------------------------+
4-
| Catalog Name| spark_catalog|
5-
|Namespace Name| default|
6-
| Comment| default database|
1+
+--------------+--------------------------------------------+
2+
| info_name| info_value|
3+
+--------------+--------------------------------------------+
4+
| Catalog Name| spark_catalog|
5+
|Namespace Name| default|
6+
| Comment| default database|
77
| Location|*|
8-
| Owner| *|
9-
+--------------+----------------------------------------+
8+
| Owner| dongjoon|
9+
+--------------+--------------------------------------------+

Tests/SparkConnectTests/SQLTests.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ struct SQLTests {
4949
return str.replacing(regexOwner, with: "*")
5050
}
5151

52+
private func normalize(_ str: String) -> String {
53+
return str.replacing(/[-]+/, with: "-").replacing(/[ ]+/, with: " ")
54+
}
55+
5256
@Test
5357
func testRemoveID() {
5458
#expect(removeID("123") == "123")
@@ -69,6 +73,12 @@ struct SQLTests {
6973
#expect(removeOwner("185") == "*")
7074
}
7175

76+
@Test
77+
func testNormalize() {
78+
#expect(normalize("+------+------------------+") == "+-+-+")
79+
#expect(normalize("+ + +") == "+ + +")
80+
}
81+
7282
let queriesForSpark4Only: [String] = [
7383
"create_scala_function.sql",
7484
"create_table_function.sql",
@@ -97,7 +107,7 @@ struct SQLTests {
97107
fm.createFile(atPath: path, contents: answer.data(using: .utf8)!, attributes: nil)
98108
} else {
99109
let expected = cleanUp(try String(contentsOf: URL(fileURLWithPath: "\(path)/\(name).answer"), encoding: .utf8))
100-
#expect(answer == expected.trimmingCharacters(in: .whitespacesAndNewlines))
110+
#expect(normalize(answer) == normalize(expected.trimmingCharacters(in: .whitespacesAndNewlines)))
101111
}
102112
}
103113
await spark.stop()

0 commit comments

Comments
 (0)