Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
swanandx committed Feb 27, 2024
1 parent 0a63d8e commit b86161b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 5 additions & 4 deletions rumqttc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ impl MqttOptions {
};

Ok(MqttOptions {

broker_addr: host.into(),
port,
addr_path: addr_path.into(),
Expand Down Expand Up @@ -649,7 +648,7 @@ impl MqttOptions {
///
/// ```should_panic
/// # use rumqttc::MqttOptions;
/// let mut options = MqttOptions::new("", "localhost", 1883);
/// let mut options = MqttOptions::new("", "localhost").unwrap();
/// options.set_clean_session(false);
/// ```
pub fn set_clean_session(&mut self, clean_session: bool) -> &mut Self {
Expand Down Expand Up @@ -825,12 +824,14 @@ mod test {

#[test]
fn accept_empty_client_id() {
let _mqtt_opts = MqttOptions::new("", "127.0.0.1", 1883).set_clean_session(true);
let _mqtt_opts = MqttOptions::new("", "127.0.0.1")
.unwrap()
.set_clean_session(true);
}

#[test]
fn set_clean_session_when_client_id_present() {
let mut options = MqttOptions::new("client_id", "127.0.0.1", 1883);
let mut options = MqttOptions::new("client_id", "127.0.0.1").unwrap();
options.set_clean_session(false);
options.set_clean_session(true);
}
Expand Down
4 changes: 3 additions & 1 deletion rumqttc/src/v5/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,8 @@ mod test {

#[test]
fn allow_empty_client_id() {
let _mqtt_opts = MqttOptions::new("", "127.0.0.1", 1883).set_clean_start(true);
let _mqtt_opts = MqttOptions::new("", "127.0.0.1")
.unwrap()
.set_clean_start(true);
}
}

0 comments on commit b86161b

Please sign in to comment.