fix example

This commit is contained in:
Jonas Kruckenberg 2022-11-14 10:44:28 +01:00
parent 52acfb3b3d
commit 6441a58a05
17 changed files with 190 additions and 81 deletions

View file

@ -2,7 +2,7 @@ use anyhow::ensure;
use tauri_sys::app;
pub async fn get_name() -> anyhow::Result<()> {
let name = app::get_name().await;
let name = app::get_name().await?;
ensure!(name == "tauri-sys-test");
@ -22,7 +22,7 @@ pub async fn get_version() -> anyhow::Result<()> {
}
pub async fn get_tauri_version() -> anyhow::Result<()> {
let version = app::get_tauri_version().await;
let version = app::get_tauri_version().await?;
ensure!(version.major == 1);
ensure!(version.minor == 1);

View file

@ -2,11 +2,11 @@ use anyhow::ensure;
use tauri_sys::clipboard;
pub async fn test() -> anyhow::Result<()> {
clipboard::write_text("foobar").await;
clipboard::write_text("foobar").await?;
let text = clipboard::read_text().await?;
ensure!(text == Some("foobar".to_string()));
ensure!(text == "foobar".to_string());
Ok(())
}

View file

@ -2,11 +2,9 @@ use anyhow::ensure;
use tauri_sys::{event, tauri};
pub async fn emit() -> anyhow::Result<()> {
event::emit("foo", &"bar").await;
event::emit("foo", &"bar").await?;
ensure!(tauri::invoke::<_, bool>("verify_receive", &())
.await
.unwrap());
ensure!(tauri::invoke::<_, bool>("verify_receive", &()).await?);
Ok(())
}

View file

@ -4,10 +4,10 @@ use tauri_sys::window;
pub async fn create_window() -> anyhow::Result<()> {
let win = window::WebviewWindow::new("foo", ());
ensure!(win.is_visible().await);
ensure!(win.is_visible().await?);
// ensure!(win.label() == "foo".to_string());
win.close().await;
win.close().await?;
Ok(())
}