Chore(Test): Update Test Example
This commit is contained in:
@@ -28,6 +28,15 @@ fn main() -> Result<(), io::Error> {
|
|||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Password of the wireless network."),
|
.help("Password of the wireless network."),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("interface")
|
||||||
|
.short("i")
|
||||||
|
.long("interface")
|
||||||
|
.multiple(false)
|
||||||
|
.default_value("wlan0")
|
||||||
|
.takes_value(true)
|
||||||
|
.help("Wireless interface to connect through."),
|
||||||
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
// Get Password
|
// Get Password
|
||||||
@@ -36,6 +45,9 @@ fn main() -> Result<(), io::Error> {
|
|||||||
// Get SSID
|
// Get SSID
|
||||||
let ssid = matches.value_of("ssid").unwrap();
|
let ssid = matches.value_of("ssid").unwrap();
|
||||||
|
|
||||||
|
// Get Wireless Interface
|
||||||
|
let ssid = matches.value_of("ssid").unwrap();
|
||||||
|
|
||||||
let wifi = WiFi::new(ssid)?;
|
let wifi = WiFi::new(ssid)?;
|
||||||
println!("Connection Status: {}", wifi.connect(password));
|
println!("Connection Status: {}", wifi.connect(password));
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn connect_to_wifi_failed() {
|
fn connect_to_wifi_failed() {
|
||||||
let config = Some(Config {
|
let config = Some(Config {
|
||||||
interface: Some(String::from("wlo1")),
|
interface: Some("wlo1"),
|
||||||
});
|
});
|
||||||
|
|
||||||
let wifi = WiFi::new("hello", config).unwrap();
|
let wifi = WiFi::new("hello", config).unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user