File tree Expand file tree Collapse file tree
src/libraries/System.Text.Json/tests/Serialization Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,10 +161,11 @@ public static void NullAcceptsLeadingAndTrailingTrivia()
161161 public static void NullReadTestChar ( )
162162 {
163163 Assert . Throws < JsonException > ( ( ) => JsonSerializer . Deserialize < char > ( "null" ) ) ;
164- Assert . Throws < JsonException > ( ( ) => JsonSerializer . Deserialize < char > ( "" ) ) ;
165- Assert . Throws < JsonException > ( ( ) => JsonSerializer . Deserialize < char > ( "1234" ) ) ;
164+ Assert . Throws < JsonException > ( ( ) => JsonSerializer . Deserialize < char > ( "\" \" " ) ) ;
165+ Assert . Throws < JsonException > ( ( ) => JsonSerializer . Deserialize < char > ( "" ) ) ; // Empty JSON is invalid
166+ Assert . Throws < JsonException > ( ( ) => JsonSerializer . Deserialize < char > ( "1234" ) ) ; // Can't convert a JSON number to JSON string/char
166167 Assert . Throws < JsonException > ( ( ) => JsonSerializer . Deserialize < char > ( "\" stringTooLong\" " ) ) ;
167- Assert . Throws < JsonException > ( ( ) => JsonSerializer . Deserialize < char > ( "\" \u0059 \" B " ) ) ;
168+ Assert . Throws < JsonException > ( ( ) => JsonSerializer . Deserialize < char > ( "\" \u0059 B \" " ) ) ;
168169 Assert . Throws < JsonException > ( ( ) => JsonSerializer . Deserialize < char > ( "\" \uD800 \uDC00 \" " ) ) ;
169170 Assert . Equal ( 'a' , JsonSerializer . Deserialize < char > ( "\" a\" " ) ) ;
170171 Assert . Equal ( 'Y' , JsonSerializer . Deserialize < char > ( "\" \u0059 \" " ) ) ;
You can’t perform that action at this time.
0 commit comments