@@ -30,11 +30,20 @@ struct SQLTests {
3030
3131 let regexID = /#\d+L?/
3232 let regexPlanId = /plan_id=\d+/
33+ let regexLocation = /file:\S+/
34+
35+ private func cleanUp( _ str: String ) -> String {
36+ return removeID ( removeLocation ( str) )
37+ }
3338
3439 private func removeID( _ str: String ) -> String {
3540 return str. replacing ( regexPlanId, with: " plan_id= " ) . replacing ( regexID, with: " # " )
3641 }
3742
43+ private func removeLocation( _ str: String ) -> String {
44+ return str. replacing ( regexLocation, with: " * " )
45+ }
46+
3847 @Test
3948 func testRemoveID( ) {
4049 #expect( removeID ( " 123 " ) == " 123 " )
@@ -44,6 +53,11 @@ struct SQLTests {
4453 #expect( removeID ( " plan_id=123 " ) == " plan_id= " )
4554 }
4655
56+ @Test
57+ func removeLocation( ) {
58+ #expect( removeLocation ( " file:/abc " ) == " * " )
59+ }
60+
4761#if !os(Linux)
4862 @Test
4963 func runAll( ) async throws {
@@ -54,8 +68,8 @@ struct SQLTests {
5468
5569 let sql = try String ( contentsOf: URL ( fileURLWithPath: " \( path) / \( name) " ) , encoding: . utf8)
5670 let jsonData = try encoder. encode ( try await spark. sql ( sql) . collect ( ) )
57- let answer = removeID ( String ( data: jsonData, encoding: . utf8) !)
58- let expected = removeID ( try String ( contentsOf: URL ( fileURLWithPath: " \( path) / \( name) .json " ) , encoding: . utf8) )
71+ let answer = cleanUp ( String ( data: jsonData, encoding: . utf8) !)
72+ let expected = cleanUp ( try String ( contentsOf: URL ( fileURLWithPath: " \( path) / \( name) .json " ) , encoding: . utf8) )
5973 #expect( answer == expected. trimmingCharacters ( in: . whitespacesAndNewlines) )
6074 }
6175 await spark. stop ( )
0 commit comments