MCPcopy Index your code
hub / github.com/Yengas/rust-chat-server / assert_command_serialization

Function assert_command_serialization

comms/src/command.rs:50–55  ·  view source on GitHub ↗

given a command enum, and an expect string, asserts that command is serialized / deserialized appropiately

(command: &UserCommand, expected: &str)

Source from the content-addressed store, hash-verified

48
49 // given a command enum, and an expect string, asserts that command is serialized / deserialized appropiately
50 fn assert_command_serialization(command: &UserCommand, expected: &str) {
51 let serialized = serde_json::to_string(&command).unwrap();
52 assert_eq!(serialized, expected);
53 let deserialized: UserCommand = serde_json::from_str(&serialized).unwrap();
54 assert_eq!(deserialized, *command);
55 }
56
57 #[test]
58 fn test_join_command() {

Callers 4

test_join_commandFunction · 0.85
test_leave_commandFunction · 0.85
test_message_commandFunction · 0.85
test_quit_commandFunction · 0.85

Calls

no outgoing calls

Tested by 4

test_join_commandFunction · 0.68
test_leave_commandFunction · 0.68
test_message_commandFunction · 0.68
test_quit_commandFunction · 0.68