Merge codex-log-game-field: log game field in presence
This commit is contained in:
+13
-2
@@ -133,12 +133,13 @@ fn admit_state_mutation(
|
||||
|
||||
fn peer_state_for_log(state: &PeerState) -> String {
|
||||
format!(
|
||||
"name={:?}, muted={}, addr_id={}, addrs={}, sharing={}",
|
||||
"name={:?}, muted={}, addr_id={}, addrs={}, sharing={}, game={:?}",
|
||||
state.name,
|
||||
state.is_muted,
|
||||
crate::short_id(&state.addr.id.to_string()),
|
||||
state.addr.addrs.len(),
|
||||
state.sharing.is_some()
|
||||
state.sharing.is_some(),
|
||||
state.game
|
||||
)
|
||||
}
|
||||
|
||||
@@ -717,6 +718,16 @@ mod tests {
|
||||
EndpointAddr::from(id)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn peer_state_log_includes_game() {
|
||||
let mut state = sample_peer_state_for(fresh_id());
|
||||
state.game = Some("Half-Life 2".to_string());
|
||||
assert!(peer_state_for_log(&state).contains("game=Some(\"Half-Life 2\")"));
|
||||
|
||||
state.game = None;
|
||||
assert!(peer_state_for_log(&state).contains("game=None"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bootstrap_client_dials_host() {
|
||||
// A non-host (client) with no retained peers dials just the ticket host.
|
||||
|
||||
Reference in New Issue
Block a user