@@ -288,7 +288,7 @@ struct JSONValueTests {
288
288
}
289
289
290
290
let user = User ( id: 1 , name: " Alice " , isActive: true )
291
- let jsonValue = try JSONValue ( codable : user)
291
+ let jsonValue = JSONValue ( encodable : user)
292
292
293
293
#expect( jsonValue. isDictionary == true )
294
294
#expect( jsonValue. dictionaryValue ? [ " id " ] == . number( 1 ) )
@@ -315,7 +315,7 @@ struct JSONValueTests {
315
315
}
316
316
317
317
let product = Product ( sku: " PRD-001 " , price: 29.99 , inStock: true )
318
- let jsonValue = try JSONValue ( codable : product)
318
+ let jsonValue = JSONValue ( encodable : product)
319
319
320
320
#expect( jsonValue. isDictionary == true )
321
321
#expect( jsonValue. dictionaryValue ? [ " sku " ] == . string( " PRD-001 " ) )
@@ -332,7 +332,7 @@ struct JSONValueTests {
332
332
}
333
333
334
334
let status = Status . active
335
- let jsonValue = try JSONValue ( codable : status)
335
+ let jsonValue = JSONValue ( encodable : status)
336
336
337
337
#expect( jsonValue. isString == true )
338
338
#expect( jsonValue. stringValue == " active " )
@@ -346,7 +346,7 @@ struct JSONValueTests {
346
346
}
347
347
348
348
let items = [ Item ( name: " Apple " , quantity: 5 ) , Item ( name: " Banana " , quantity: 3 ) ]
349
- let jsonValue = try JSONValue ( codable : items)
349
+ let jsonValue = JSONValue ( encodable : items)
350
350
351
351
#expect( jsonValue. isArray == true )
352
352
#expect( jsonValue. arrayValue? . count == 2 )
@@ -364,7 +364,7 @@ struct JSONValueTests {
364
364
" license " : " MIT "
365
365
]
366
366
367
- let jsonValue = try JSONValue ( codable : metadata)
367
+ let jsonValue = JSONValue ( encodable : metadata)
368
368
369
369
#expect( jsonValue. isDictionary == true )
370
370
#expect( jsonValue. dictionaryValue ? [ " version " ] == . string( " 1.0.0 " ) )
@@ -394,7 +394,7 @@ struct JSONValueTests {
394
394
hobbies: [ " reading " , " swimming " , " coding " ]
395
395
)
396
396
397
- let jsonValue = try JSONValue ( codable : person)
397
+ let jsonValue = JSONValue ( encodable : person)
398
398
399
399
#expect( jsonValue. isDictionary == true )
400
400
#expect( jsonValue. dictionaryValue ? [ " name " ] == . string( " Bob " ) )
@@ -422,8 +422,8 @@ struct JSONValueTests {
422
422
let configWithValues = Config ( apiKey: " secret-key " , debugMode: true )
423
423
let configWithNil = Config ( apiKey: nil , debugMode: nil )
424
424
425
- let jsonValue1 = try JSONValue ( codable : configWithValues)
426
- let jsonValue2 = try JSONValue ( codable : configWithNil)
425
+ let jsonValue1 = JSONValue ( encodable : configWithValues)
426
+ let jsonValue2 = JSONValue ( encodable : configWithNil)
427
427
428
428
#expect( jsonValue1. dictionaryValue ? [ " apiKey " ] == . string( " secret-key " ) )
429
429
#expect( jsonValue1. dictionaryValue ? [ " debugMode " ] == . bool( true ) )
@@ -446,7 +446,7 @@ struct JSONValueTests {
446
446
}
447
447
448
448
let user = User ( userId: 123 , fullName: " John Doe " )
449
- let jsonValue = try JSONValue ( codable : user)
449
+ let jsonValue = JSONValue ( encodable : user)
450
450
451
451
#expect( jsonValue. isDictionary == true )
452
452
#expect( jsonValue. dictionaryValue ? [ " user_id " ] == . number( 123 ) )
@@ -464,7 +464,7 @@ struct JSONValueTests {
464
464
465
465
let date = Date ( timeIntervalSince1970: 1234567890 )
466
466
let event = Event ( name: " Conference " , date: date)
467
- let jsonValue = try JSONValue ( codable : event)
467
+ let jsonValue = JSONValue ( encodable : event)
468
468
469
469
#expect( jsonValue. isDictionary == true )
470
470
#expect( jsonValue. dictionaryValue ? [ " name " ] == . string( " Conference " ) )
@@ -484,7 +484,7 @@ struct JSONValueTests {
484
484
485
485
let content = " Hello, World! " . data ( using: . utf8) !
486
486
let file = File ( name: " greeting.txt " , content: content)
487
- let jsonValue = try JSONValue ( codable : file)
487
+ let jsonValue = JSONValue ( encodable : file)
488
488
489
489
#expect( jsonValue. isDictionary == true )
490
490
#expect( jsonValue. dictionaryValue ? [ " name " ] == . string( " greeting.txt " ) )
0 commit comments