| 1 | #![cfg(feature = "serde")] |
| 2 | |
| 3 | extern crate serde_testrust-analyzer cargo sshkeys 0.3.4 serde_test/; |
| 4 | extern crate sshkeysrust-analyzer cargo sshkeys 0.3.4 sshkeys/; |
| 5 | |
| 6 | use selfrust-analyzer cargo sshkeys 0.3.4 crate/::serde_testrust-analyzer cargo serde_test 1.0.177 crate/::{assert_de_tokens_errorrust-analyzer cargo serde_test 1.0.177 assert/assert_de_tokens_error()., assert_tokensrust-analyzer cargo serde_test 1.0.177 assert/assert_tokens()., Tokenrust-analyzer cargo serde_test 1.0.177 token/Token#}; |
| 7 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 8 | |
| 9 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 10 | fn serde_ok_both_waysrust-analyzer cargo sshkeys 0.3.4 serde_ok_both_ways().() { |
| 11 | let key = sshkeysrust-analyzer cargo sshkeys 0.3.4 crate/::PublicKeyrust-analyzer cargo sshkeys 0.3.4 pubkey/PublicKey#::from_pathrust-analyzer cargo sshkeys 0.3.4 pubkey/impl#[PublicKey]from_path().("tests/test-keys/id_ed25519.pub").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 12 | |
| 13 | assert_tokensrust-analyzer cargo serde_test 1.0.177 assert/assert_tokens().( |
| 14 | &key, |
| 15 | &[Tokenrust-analyzer cargo serde_test 1.0.177 token/Token#::Stringrust-analyzer cargo serde_test 1.0.177 token/Token#String#( |
| 16 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMIVp6q5co/r5GwY0dH+NYQbfKicapeF3gXEU3dzaAvD me@home", |
| 17 | )], |
| 18 | ); |
| 19 | } |
| 20 | |
| 21 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 22 | fn serde_de_errorrust-analyzer cargo sshkeys 0.3.4 serde_de_error().() { |
| 23 | struct MockErrorrust-analyzer cargo sshkeys 0.3.4 MockError# {} |
| 24 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for MockErrorrust-analyzer cargo sshkeys 0.3.4 MockError# { |
| 25 | fn fmtrust-analyzer cargo sshkeys 0.3.4 impl#[MockError][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 26 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Invalid format") |
| 27 | } |
| 28 | } |
| 29 | let err_format = MockErrorrust-analyzer cargo sshkeys 0.3.4 MockError# {}.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 30 | |
| 31 | assert_de_tokens_errorrust-analyzer cargo serde_test 1.0.177 assert/assert_de_tokens_error().::<sshkeysrust-analyzer cargo sshkeys 0.3.4 crate/::PublicKeyrust-analyzer cargo sshkeys 0.3.4 pubkey/PublicKey#>(&[Tokenrust-analyzer cargo serde_test 1.0.177 token/Token#::Strrust-analyzer cargo serde_test 1.0.177 token/Token#Str#("M")], &err_format); |
| 32 | assert_de_tokens_errorrust-analyzer cargo serde_test 1.0.177 assert/assert_de_tokens_error().::<sshkeysrust-analyzer cargo sshkeys 0.3.4 crate/::PublicKeyrust-analyzer cargo sshkeys 0.3.4 pubkey/PublicKey#>(&[Tokenrust-analyzer cargo serde_test 1.0.177 token/Token#::Strrust-analyzer cargo serde_test 1.0.177 token/Token#Str#("")], &err_format); |
| 33 | } |