Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
chore: cfg(test) a test in rpc. (#3978)
Piotr Osiewiczab6cd1d93aa7
diff --git a/Cargo.lock b/Cargo.lockindex c6e7ecebc13..49af5ec2d47 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1515,7 +1515,7 @@ dependencies = ["tonic","tower","tracing",- "tracing-log",+ "tracing-log 0.1.3","tracing-subscriber","unindent","util",@@ -6930,9 +6930,9 @@ dependencies = [[[package]]name = "sharded-slab"-version = "0.1.4"+version = "0.1.7"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"+checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"dependencies = ["lazy_static",]@@ -8316,6 +8316,17 @@ dependencies = ["tracing-core",]+[[package]]+name = "tracing-log"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"+dependencies = [+ "log",+ "once_cell",+ "tracing-core",+]+[[package]]name = "tracing-serde"version = "0.1.3"@@ -8328,9 +8339,9 @@ dependencies = [[[package]]name = "tracing-subscriber"-version = "0.3.17"+version = "0.3.18"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77"+checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"dependencies = ["matchers","nu-ansi-term",@@ -8343,7 +8354,7 @@ dependencies = ["thread_local","tracing","tracing-core",- "tracing-log",+ "tracing-log 0.2.0","tracing-serde",]diff --git a/crates/rpc/src/notification.rs b/crates/rpc/src/notification.rsindex c5476469be9..57131d34217 100644--- a/crates/rpc/src/notification.rs+++ b/crates/rpc/src/notification.rs@@ -76,30 +76,35 @@ impl Notification {}}-#[test]-fn test_notification() {- // Notifications can be serialized and deserialized.- for notification in [- Notification::ContactRequest { sender_id: 1 },- Notification::ContactRequestAccepted { responder_id: 2 },- Notification::ChannelInvitation {- channel_id: 100,- channel_name: "the-channel".into(),- inviter_id: 50,- },- Notification::ChannelMessageMention {- sender_id: 200,- channel_id: 30,- message_id: 1,- },- ] {- let message = notification.to_proto();- let deserialized = Notification::from_proto(&message).unwrap();- assert_eq!(deserialized, notification);- }+#[cfg(test)]+mod tests {+ use crate::Notification;++ #[test]+ fn test_notification() {+ // Notifications can be serialized and deserialized.+ for notification in [+ Notification::ContactRequest { sender_id: 1 },+ Notification::ContactRequestAccepted { responder_id: 2 },+ Notification::ChannelInvitation {+ channel_id: 100,+ channel_name: "the-channel".into(),+ inviter_id: 50,+ },+ Notification::ChannelMessageMention {+ sender_id: 200,+ channel_id: 30,+ message_id: 1,+ },+ ] {+ let message = notification.to_proto();+ let deserialized = Notification::from_proto(&message).unwrap();+ assert_eq!(deserialized, notification);+ }- // When notifications are serialized, the `kind` and `actor_id` fields are- // stored separately, and do not appear redundantly in the JSON.- let notification = Notification::ContactRequest { sender_id: 1 };- assert_eq!(notification.to_proto().content, "{}");+ // When notifications are serialized, the `kind` and `actor_id` fields are+ // stored separately, and do not appear redundantly in the JSON.+ let notification = Notification::ContactRequest { sender_id: 1 };+ assert_eq!(notification.to_proto().content, "{}");+ }}