| 1 | use ronrust-analyzer cargo ron 0.12.0 crate/::derust-analyzer cargo ron 0.12.0 de/::{from_strrust-analyzer cargo ron 0.12.0 de/from_str()., Errorrust-analyzer cargo ron 0.12.0 error/Error#, Positionrust-analyzer cargo ron 0.12.0 error/Position#, Spanrust-analyzer cargo ron 0.12.0 error/Span#, SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# as RonErrrust-analyzer cargo ron 0.12.0 error/SpannedError#}; |
| 2 | |
| 3 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 4 | fn test_simplerust-analyzer cargo ron 0.12.0 test_simple().() { |
| 5 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 6 | from_strrust-analyzer cargo ron 0.12.0 de/from_str().( |
| 7 | "/* |
| 8 | * We got a hexadecimal number here! |
| 9 | * |
| 10 | */0x507" |
| 11 | ), |
| 12 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0x507) |
| 13 | ); |
| 14 | } |
| 15 | |
| 16 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 17 | fn test_nestedrust-analyzer cargo ron 0.12.0 test_nested().() { |
| 18 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 19 | from_strrust-analyzer cargo ron 0.12.0 de/from_str().( |
| 20 | "/* |
| 21 | /* quite * some * nesting * going * on * /* here /* (yeah, maybe a bit too much) */ */ */ |
| 22 | */ |
| 23 | // The actual value comes.. /* |
| 24 | // very soon, these are just checks that */ |
| 25 | // multi-line comments don't trigger in line comments /* |
| 26 | \"THE VALUE\" /* This is the value /* :) */ */ |
| 27 | " |
| 28 | ), |
| 29 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("THE VALUE".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()) |
| 30 | ); |
| 31 | } |
| 32 | |
| 33 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 34 | fn test_unclosedrust-analyzer cargo ron 0.12.0 test_unclosed().() { |
| 35 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 36 | from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>("\"hi\" /*"), |
| 37 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(RonErrrust-analyzer cargo ron 0.12.0 error/SpannedError# { |
| 38 | coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnclosedBlockCommentrust-analyzer cargo ron 0.12.0 error/Error#UnclosedBlockComment#, |
| 39 | spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# { |
| 40 | startrust-analyzer cargo ron 0.12.0 error/Span#start.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 6 }, |
| 41 | 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.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 8 } |
| 42 | } |
| 43 | }) |
| 44 | ); |
| 45 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 46 | from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>( |
| 47 | "/* |
| 48 | /* quite * some * nesting * going * on * /* here /* (yeah, maybe a bit too much) */ */ */ |
| 49 | */ |
| 50 | // The actual value comes.. /* |
| 51 | // very soon, these are just checks that */ |
| 52 | // multi-line comments don't trigger in line comments /* |
| 53 | /* Unfortunately, this comment won't get closed :( |
| 54 | \"THE VALUE (which is invalid)\" |
| 55 | " |
| 56 | ), |
| 57 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(RonErrrust-analyzer cargo ron 0.12.0 error/SpannedError# { |
| 58 | coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnclosedBlockCommentrust-analyzer cargo ron 0.12.0 error/Error#UnclosedBlockComment#, |
| 59 | spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# { |
| 60 | startrust-analyzer cargo ron 0.12.0 error/Span#start.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 7, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 3 }, |
| 61 | 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.: 9, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 1 } |
| 62 | } |
| 63 | }) |
| 64 | ); |
| 65 | } |
| 66 | |
| 67 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 68 | fn test_unexpected_byterust-analyzer cargo ron 0.12.0 test_unexpected_byte().() { |
| 69 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 70 | from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<u8>("42 /q"), |
| 71 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(RonErrrust-analyzer cargo ron 0.12.0 error/SpannedError# { |
| 72 | coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnexpectedCharrust-analyzer cargo ron 0.12.0 error/Error#UnexpectedChar#('q'), |
| 73 | spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# { |
| 74 | startrust-analyzer cargo ron 0.12.0 error/Span#start.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 4 }, |
| 75 | 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.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 6 }, |
| 76 | } |
| 77 | }) |
| 78 | ); |
| 79 | } |