@@ -23,6 +23,7 @@ final class ConfigurationTests: XCTestCase {
23
23
24
24
let emptyDictionaryData = " {} \n " . data ( using: . utf8) !
25
25
let jsonDecoder = JSONDecoder ( )
26
+ jsonDecoder. allowsJSON5 = true
26
27
let emptyJSONConfig =
27
28
try ! jsonDecoder. decode ( Configuration . self, from: emptyDictionaryData)
28
29
@@ -79,7 +80,9 @@ final class ConfigurationTests: XCTestCase {
79
80
}
80
81
""" . data ( using: . utf8) !
81
82
82
- let config = try JSONDecoder ( ) . decode ( Configuration . self, from: jsonData)
83
+ let jsonDecoder = JSONDecoder ( )
84
+ jsonDecoder. allowsJSON5 = true
85
+ let config = try jsonDecoder. decode ( Configuration . self, from: jsonData)
83
86
XCTAssertEqual ( config. reflowMultilineStringLiterals, expectedBehavior)
84
87
}
85
88
}
@@ -99,9 +102,26 @@ final class ConfigurationTests: XCTestCase {
99
102
}
100
103
""" . data ( using: . utf8) !
101
104
102
- let config = try JSONDecoder ( ) . decode ( Configuration . self, from: jsonData)
105
+ let jsonDecoder = JSONDecoder ( )
106
+ jsonDecoder. allowsJSON5 = true
107
+ let config = try jsonDecoder. decode ( Configuration . self, from: jsonData)
103
108
XCTAssertEqual ( config. reflowMultilineStringLiterals, expectedBehavior)
104
109
}
105
110
}
106
111
112
+ func testConfigurationWithComments( ) throws {
113
+ let expected = Configuration ( )
114
+
115
+ let jsonData = """
116
+ {
117
+ // Indicates the configuration schema version.
118
+ " version " : 1,
119
+ }
120
+ """ . data ( using: . utf8) !
121
+
122
+ let jsonDecoder = JSONDecoder ( )
123
+ jsonDecoder. allowsJSON5 = true
124
+ let config = try jsonDecoder. decode ( Configuration . self, from: jsonData)
125
+ XCTAssertEqual ( config, expected)
126
+ }
107
127
}
0 commit comments