| 1 | use ronrust-analyzer cargo ron 0.12.0 crate/::{ |
| 2 | derust-analyzer cargo ron 0.12.0 de/::{from_bytesrust-analyzer cargo ron 0.12.0 de/from_bytes()., from_strrust-analyzer cargo ron 0.12.0 de/from_str().}, |
| 3 | errorrust-analyzer cargo ron 0.12.0 error/::Positionrust-analyzer cargo ron 0.12.0 error/Position#, |
| 4 | Errorrust-analyzer cargo ron 0.12.0 error/Error#, Valuerust-analyzer cargo ron 0.12.0 value/Value#, |
| 5 | }; |
| 6 | |
| 7 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 8 | fn test_charrust-analyzer cargo ron 0.12.0 test_char().() { |
| 9 | let de: char = from_strrust-analyzer cargo ron 0.12.0 de/from_str().("'Փ'").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 10 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(de, 'Փ'); |
| 11 | } |
| 12 | |
| 13 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 14 | fn test_stringrust-analyzer cargo ron 0.12.0 test_string().() { |
| 15 | let de: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = from_strrust-analyzer cargo ron 0.12.0 de/from_str().("\"My string: ऄ\"").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 16 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(de, "My string: ऄ"); |
| 17 | } |
| 18 | |
| 19 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 20 | fn test_char_not_a_commentrust-analyzer cargo ron 0.12.0 test_char_not_a_comment().() { |
| 21 | let _ = from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<ronrust-analyzer cargo ron 0.12.0 crate/::Valuerust-analyzer cargo ron 0.12.0 value/Value#>("A('/')").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 22 | } |
| 23 | |
| 24 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 25 | fn ident_starts_with_non_ascii_byterust-analyzer cargo ron 0.12.0 ident_starts_with_non_ascii_byte().() { |
| 26 | let _ = from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<Valuerust-analyzer cargo ron 0.12.0 value/Value#>("שּׁȬSSSSSSSSSSR").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 27 | } |
| 28 | |
| 29 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 30 | fn test_file_invalid_unicoderust-analyzer cargo ron 0.12.0 test_file_invalid_unicode().() { |
| 31 | let error = from_bytesrust-analyzer cargo ron 0.12.0 de/from_bytes().::<Valuerust-analyzer cargo ron 0.12.0 value/Value#>(&[b'\n', b'a', 0b11000000, 0]).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 32 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(error.coderust-analyzer cargo ron 0.12.0 error/SpannedError#code., Errorrust-analyzer cargo ron 0.12.0 error/Error#::Utf8Errorrust-analyzer cargo ron 0.12.0 error/Error#Utf8Error#(_))); |
| 33 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(error.spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span..endrust-analyzer cargo ron 0.12.0 error/Span#end., Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 2, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 2 }); |
| 34 | let error = from_bytesrust-analyzer cargo ron 0.12.0 de/from_bytes().::<Valuerust-analyzer cargo ron 0.12.0 value/Value#>(&[b'\n', b'\n', 0b11000000]).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 35 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(error.coderust-analyzer cargo ron 0.12.0 error/SpannedError#code., Errorrust-analyzer cargo ron 0.12.0 error/Error#::Utf8Errorrust-analyzer cargo ron 0.12.0 error/Error#Utf8Error#(_))); |
| 36 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(error.spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span..endrust-analyzer cargo ron 0.12.0 error/Span#end., Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 3, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 1 }); |
| 37 | } |
| 38 | |
| 39 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 40 | fn serialize_invalid_whitespacerust-analyzer cargo ron 0.12.0 serialize_invalid_whitespace().() { |
| 41 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 42 | ronrust-analyzer cargo ron 0.12.0 crate/::serrust-analyzer cargo ron 0.12.0 ser/::to_string_prettyrust-analyzer cargo ron 0.12.0 ser/to_string_pretty().(&42, ronrust-analyzer cargo ron 0.12.0 crate/::serrust-analyzer cargo ron 0.12.0 ser/::PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#::defaultrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig][Default]default().().new_linerust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]new_line().("a")) |
| 43 | .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(), |
| 44 | Errorrust-analyzer cargo ron 0.12.0 error/Error#::Messagerust-analyzer cargo ron 0.12.0 error/Error#Message#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().( |
| 45 | "Invalid non-whitespace `PrettyConfig::new_line`" |
| 46 | )) |
| 47 | ); |
| 48 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 49 | ronrust-analyzer cargo ron 0.12.0 crate/::serrust-analyzer cargo ron 0.12.0 ser/::to_string_prettyrust-analyzer cargo ron 0.12.0 ser/to_string_pretty().(&42, ronrust-analyzer cargo ron 0.12.0 crate/::serrust-analyzer cargo ron 0.12.0 ser/::PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#::defaultrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig][Default]default().().indentorrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]indentor().("a")) |
| 50 | .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(), |
| 51 | Errorrust-analyzer cargo ron 0.12.0 error/Error#::Messagerust-analyzer cargo ron 0.12.0 error/Error#Message#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().( |
| 52 | "Invalid non-whitespace `PrettyConfig::indentor`" |
| 53 | )) |
| 54 | ); |
| 55 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 56 | ronrust-analyzer cargo ron 0.12.0 crate/::serrust-analyzer cargo ron 0.12.0 ser/::to_string_prettyrust-analyzer cargo ron 0.12.0 ser/to_string_pretty().(&42, ronrust-analyzer cargo ron 0.12.0 crate/::serrust-analyzer cargo ron 0.12.0 ser/::PrettyConfigrust-analyzer cargo ron 0.12.0 ser/PrettyConfig#::defaultrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig][Default]default().().separatorrust-analyzer cargo ron 0.12.0 ser/impl#[PrettyConfig]separator().("a")) |
| 57 | .unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(), |
| 58 | Errorrust-analyzer cargo ron 0.12.0 error/Error#::Messagerust-analyzer cargo ron 0.12.0 error/Error#Message#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().( |
| 59 | "Invalid non-whitespace `PrettyConfig::separator`" |
| 60 | )) |
| 61 | ); |
| 62 | } |