@@ -30,7 +30,11 @@ struct SQLTests {
30
30
31
31
let regexID = /#\d+L?/
32
32
let regexPlanId = /plan_id=\d+/
33
- let regexLocation = /file:\w+/
33
+ let regexLocation = /file:\S+/
34
+
35
+ private func cleanUp( _ str: String ) -> String {
36
+ return removeID ( removeLocation ( str) )
37
+ }
34
38
35
39
private func removeID( _ str: String ) -> String {
36
40
return str. replacing ( regexPlanId, with: " plan_id= " ) . replacing ( regexID, with: " # " )
@@ -49,6 +53,11 @@ struct SQLTests {
49
53
#expect( removeID ( " plan_id=123 " ) == " plan_id= " )
50
54
}
51
55
56
+ @Test
57
+ func removeLocation( ) {
58
+ #expect( removeLocation ( " file:/abc " ) == " * " )
59
+ }
60
+
52
61
#if !os(Linux)
53
62
@Test
54
63
func runAll( ) async throws {
@@ -59,8 +68,8 @@ struct SQLTests {
59
68
60
69
let sql = try String ( contentsOf: URL ( fileURLWithPath: " \( path) / \( name) " ) , encoding: . utf8)
61
70
let jsonData = try encoder. encode ( try await spark. sql ( sql) . collect ( ) )
62
- let answer = removeID ( String ( data: jsonData, encoding: . utf8) !)
63
- 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) )
64
73
#expect( answer == expected. trimmingCharacters ( in: . whitespacesAndNewlines) )
65
74
}
66
75
await spark. stop ( )
0 commit comments