3030
3131///|
3232test {
33- let u = Json ::array([Json ::number(1), Json ::string ("str")])
33+ let u = Json ::array([Json ::number(1), Json ("str")])
3434 let err = expect_json_decode_error(
3535 () => ignore((@json.from_json(u) : Array [Int ])),
3636 "expected Array [Int ] decode failure",
4747test {
4848 let u = Json ::object({
4949 "x": Json ::object({ "xx": Json ::number(1) }),
50- "y": Json ::object({ "yy": Json ::string ("str") }),
50+ "y": Json ::object({ "yy": Json ("str") }),
5151 })
5252 let err = expect_json_decode_error(
5353 () => ignore((@json.from_json(u) : Map [String , Map [String , Double ]])),
@@ -393,22 +393,22 @@ test "bigint" {
393393
394394///|
395395test " jsonvalue " {
396- let u = Json ::string ("str")
396+ let u = Json ("str")
397397 let v : Json = @json.from_json(u)
398398 debug_inspect(v, content="String (\"str\")")
399399 let u = Json ::number(123)
400400 let v : Json = @json.from_json(u)
401401 debug_inspect(v, content="Number (123)")
402- let u = Json ::boolean (true )
402+ let u = Json (true )
403403 let v : Json = @json.from_json(u)
404404 debug_inspect(v, content="True ")
405- let u = Json ::boolean (false )
405+ let u = Json (false )
406406 let v : Json = @json.from_json(u)
407407 debug_inspect(v, content="False ")
408408 let u = null
409409 let v : Json = @json.from_json(u)
410410 debug_inspect(v, content="Null ")
411- let u = Json ::array([Json ::number(1), Json ::string ("str")])
411+ let u = Json ::array([Json ::number(1), Json ("str")])
412412 let v : Json = @json.from_json(u)
413413 debug_inspect(
414414 v,
@@ -636,7 +636,7 @@ test "Bool from_json error handling" {
636636 #|JsonDecodeError ((Root , "Bool ::from_json: expected boolean"))
637637 ),
638638 )
639- let json_string = Json ::string ("true ")
639+ let json_string = Json ("true ")
640640 let err = expect_json_decode_error(
641641 () => ignore((@json.from_json(json_string) : Bool )),
642642 "expected Bool decode failure",
@@ -662,7 +662,7 @@ test "Int64 from_json error handling" {
662662 #|JsonDecodeError ((Root , "Int64 ::from_json: expected number in string representation"))
663663 ),
664664 )
665- let json_invalid_string = Json ::string ("not a number")
665+ let json_invalid_string = Json ("not a number")
666666 let err = expect_json_decode_error(
667667 () => ignore((@json.from_json(json_invalid_string) : Int64 )),
668668 "expected Int64 parse failure",
@@ -677,7 +677,7 @@ test "Int64 from_json error handling" {
677677
678678///|
679679test " UInt from_json error handling " {
680- let json_string = Json ::string ("123")
680+ let json_string = Json ("123")
681681 let err = expect_json_decode_error(
682682 () => ignore((@json.from_json(json_string) : UInt )),
683683 "expected UInt decode failure",
@@ -703,7 +703,7 @@ test "UInt64 from_json error handling" {
703703 #|JsonDecodeError ((Root , "UInt64 ::from_json: expected number in string representation"))
704704 ),
705705 )
706- let json_invalid_string = Json ::string ("not a number")
706+ let json_invalid_string = Json ("not a number")
707707 let err = expect_json_decode_error(
708708 () => ignore((@json.from_json(json_invalid_string) : UInt64 )),
709709 "expected UInt64 parse failure",
@@ -759,7 +759,7 @@ test "Char from_json error handling" {
759759 #|JsonDecodeError ((Root , "Char ::from_json: expected string"))
760760 ),
761761 )
762- let json_empty_string = Json ::string ("")
762+ let json_empty_string = Json ("")
763763 let err = expect_json_decode_error(
764764 () => ignore((@json.from_json(json_empty_string) : Char )),
765765 "expected Char decode failure",
@@ -770,7 +770,7 @@ test "Char from_json error handling" {
770770 #|JsonDecodeError ((Root , "Char ::from_json: expected single character"))
771771 ),
772772 )
773- let json_long_string = Json ::string ("abc")
773+ let json_long_string = Json ("abc")
774774 let err = expect_json_decode_error(
775775 () => ignore((@json.from_json(json_long_string) : Char )),
776776 "expected Char decode failure",
@@ -796,7 +796,7 @@ test "BigInt from_json error handling" {
796796 #|JsonDecodeError ((Root , "BigInt ::from_json: expected number in string representation"))
797797 ),
798798 )
799- let json_invalid_number = Json ::string ("not-a-number")
799+ let json_invalid_number = Json ("not-a-number")
800800 let err = expect_json_decode_error(
801801 () => ignore((@json.from_json(json_invalid_number) : BigInt )),
802802 "expected invalid BigInt decode failure",
@@ -811,7 +811,7 @@ test "BigInt from_json error handling" {
811811
812812///|
813813test " Array from_json error handling " {
814- let json_string = Json ::string ("not an array")
814+ let json_string = Json ("not an array")
815815 let err = expect_json_decode_error(
816816 () => ignore((@json.from_json(json_string) : Array [Int ])),
817817 "expected Array decode failure",
@@ -826,7 +826,7 @@ test "Array from_json error handling" {
826826
827827///|
828828test " FixedArray from_json error handling " {
829- let json_string = Json ::string ("not an array")
829+ let json_string = Json ("not an array")
830830 let err = expect_json_decode_error(
831831 () => ignore((@json.from_json(json_string) : FixedArray [Int ])),
832832 "expected FixedArray decode failure",
@@ -856,7 +856,7 @@ test "Map from_json error handling" {
856856
857857///|
858858test " Option from_json error handling " {
859- let json_string = Json ::string ("not an option")
859+ let json_string = Json ("not an option")
860860 let err = expect_json_decode_error(
861861 () => ignore((@json.from_json(json_string) : Int? )),
862862 "expected Option decode failure",
@@ -871,7 +871,7 @@ test "Option from_json error handling" {
871871
872872///|
873873test " Result from_json error handling " {
874- let json_string = Json ::string ("not a result")
874+ let json_string = Json ("not a result")
875875 let err = expect_json_decode_error(
876876 () => ignore((@json.from_json(json_string) : Result [Int , String ])),
877877 "expected Result decode failure",
@@ -908,7 +908,7 @@ test "Result from_json error handling" {
908908
909909///|
910910test " Unit from_json error handling " {
911- let json_string = Json ::string ("not null")
911+ let json_string = Json ("not null")
912912 let err = expect_json_decode_error(
913913 () => ignore((@json.from_json(json_string) : Unit )),
914914 "expected Unit decode failure",
@@ -950,17 +950,17 @@ test "float roundtrip" {
950950///|
951951test " float special values " {
952952 // Test NaN
953- let u = Json ::string ("NaN ")
953+ let u = Json ("NaN ")
954954 let v : Float = @json.from_json(u)
955955 inspect(v, content="NaN ")
956956
957957 // Test Infinity
958- let u = Json ::string ("Infinity ")
958+ let u = Json ("Infinity ")
959959 let v : Float = @json.from_json(u)
960960 inspect(v, content="Infinity ")
961961
962962 // Test -Infinity
963- let u = Json ::string ("-Infinity ")
963+ let u = Json ("-Infinity ")
964964 let v : Float = @json.from_json(u)
965965 inspect(v, content="-Infinity ")
966966
@@ -972,7 +972,7 @@ test "float special values" {
972972
973973///|
974974test " Float from_json error handling " {
975- let json_string = Json ::string ("not a number")
975+ let json_string = Json ("not a number")
976976 let err = expect_json_decode_error(
977977 () => ignore((@json.from_json(json_string) : Float )),
978978 "expected Float decode failure",
@@ -1032,14 +1032,14 @@ test "ArrayView::from_json" {
10321032
10331033///|
10341034test " from_json special cases " {
1035- let nan_value : Double = @json.from_json(Json ::string ("NaN "))
1035+ let nan_value : Double = @json.from_json(Json ("NaN "))
10361036 @json.json_inspect(nan_value, content="NaN ")
1037- let inf_value : Double = @json.from_json(Json ::string ("Infinity "))
1037+ let inf_value : Double = @json.from_json(Json ("Infinity "))
10381038 @json.json_inspect(inf_value, content="Infinity ")
1039- let neg_inf_value : Double = @json.from_json(Json ::string ("-Infinity "))
1039+ let neg_inf_value : Double = @json.from_json(Json ("-Infinity "))
10401040 @json.json_inspect(neg_inf_value, content="-Infinity ")
10411041 let array_view_err = expect_json_decode_error(
1042- () => ignore((@json.from_json(Json ::string ("oops")) : ArrayView [Int ])),
1042+ () => ignore((@json.from_json(Json ("oops")) : ArrayView [Int ])),
10431043 "expected ArrayView ::from_json error",
10441044 )
10451045 guard array_view_err
@@ -1055,15 +1055,15 @@ test "from_json special cases" {
10551055 fail("expected Bytes ::from_json type error")
10561056 }
10571057 let bytes_escape_err = expect_json_decode_error(
1058- () => ignore((@json.from_json(Json ::string ("bad\\\\")) : Bytes )),
1058+ () => ignore((@json.from_json(Json ("bad\\\\")) : Bytes )),
10591059 "expected Bytes ::from_json escape error",
10601060 )
10611061 guard bytes_escape_err
10621062 is JsonDecodeError ((_, "Bytes ::from_json: invalid escape sequence")) else {
10631063 fail("expected Bytes ::from_json escape error")
10641064 }
10651065 let bytes_invalid_err = expect_json_decode_error(
1066- () => ignore((@json.from_json(Json ::string ("\u{0}")) : Bytes )),
1066+ () => ignore((@json.from_json(Json ("\u{0}")) : Bytes )),
10671067 "expected Bytes ::from_json byte error",
10681068 )
10691069 guard bytes_invalid_err
0 commit comments