File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 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+ +--------------+-------------------------------------------- +
Original file line number Diff line number Diff 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 ( )
You can’t perform that action at this time.
0 commit comments