File tree Expand file tree Collapse file tree 2 files changed +0
-50
lines changed
Expand file tree Collapse file tree 2 files changed +0
-50
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,10 @@ enum YYJSONParser {
5252 // - Inf/NaN literals in numeric fields
5353 // - Trailing commas after the last element in objects/arrays
5454 // - UTF-8 BOM prefix from files served over the network
55- // - C-style single-line (//) and block (/* */) comments
5655 let flags : yyjson_read_flag =
5756 YYJSON_READ_ALLOW_INF_AND_NAN
5857 | YYJSON_READ_ALLOW_TRAILING_COMMAS
5958 | YYJSON_READ_ALLOW_BOM
60- | YYJSON_READ_ALLOW_COMMENTS
6159 let doc = yyjson_read_opts (
6260 UnsafeMutableRawPointer ( mutating: baseAddress) . assumingMemoryBound ( to: CChar . self) ,
6361 buffer. count,
Original file line number Diff line number Diff line change @@ -139,54 +139,6 @@ struct YYJSONParserTests {
139139 let array = config [ " b " ] . array ( )
140140 #expect( array? . count == 2 )
141141 }
142-
143- @Test
144- func allowsSingleLineComments( ) throws {
145- let json = """
146- {
147- // this is a comment
148- " key " : " value " ,
149- " number " : 42
150- }
151- """
152- let config = try YYJSONParser . parseToConfig ( Data ( json. utf8) )
153-
154- #expect( config [ " key " ] . string ( ) == " value " )
155- #expect( config [ " number " ] . integer ( ) == 42 )
156- }
157-
158- @Test
159- func allowsMultiLineComments( ) throws {
160- let json = """
161- {
162- /* block comment
163- spanning multiple lines */
164- " key " : " value "
165- }
166- """
167- let config = try YYJSONParser . parseToConfig ( Data ( json. utf8) )
168-
169- #expect( config [ " key " ] . string ( ) == " value " )
170- }
171-
172- @Test
173- func allowsCommentsWithTrailingCommas( ) throws {
174- let json = """
175- {
176- " a " : 1, // inline comment
177- " b " : [
178- 2, /* another comment */
179- 3,
180- ],
181- }
182- """
183- let config = try YYJSONParser . parseToConfig ( Data ( json. utf8) )
184-
185- #expect( config [ " a " ] . integer ( ) == 1 )
186- let array = config [ " b " ] . array ( )
187- #expect( array? . count == 2 )
188- #expect( array ? [ 1 ] . integer ( ) == 3 )
189- }
190142}
191143
192144// MARK: - Foundation / YYJSONParser comparison tests
You can’t perform that action at this time.
0 commit comments