mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
test(docs): run doctest on CI, make sure doctests pass (#3620)
* test(docs): run doctest on CI, make sure doctests pass * no_run on dialog doctests [skip ci]
This commit is contained in:
@@ -299,3 +299,13 @@ jobs:
|
||||
- name: test ${{ matrix.package }}
|
||||
if: ${{ matrix.package == 'tauri-plugin-http' || matrix.package == 'tauri-plugin-dialog' }}
|
||||
run: ${{ matrix.platform.runner }} ${{ matrix.platform.command }} --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets
|
||||
|
||||
# `--all-targets` above does not include doc tests, so they are run separately.
|
||||
# Only on the platforms we actually test on, since cargo skips doc tests when cross compiling.
|
||||
- name: doc test ${{ matrix.package }}
|
||||
if: ${{ matrix.platform.command == 'test' && matrix.package != 'tauri-plugin-http' && matrix.package != 'tauri-plugin-dialog' }}
|
||||
run: ${{ matrix.platform.runner }} test --doc --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-features
|
||||
|
||||
- name: doc test ${{ matrix.package }}
|
||||
if: ${{ matrix.platform.command == 'test' && (matrix.package == 'tauri-plugin-http' || matrix.package == 'tauri-plugin-dialog') }}
|
||||
run: ${{ matrix.platform.runner }} test --doc --package ${{ matrix.package }} --target ${{ matrix.platform.target }}
|
||||
|
||||
@@ -27,6 +27,9 @@ ios = { level = "none", notes = "" }
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tauri = { workspace = true, features = ["wry"] }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
+17
-17
@@ -113,7 +113,7 @@ impl<R: Runtime> Dialog<R> {
|
||||
///
|
||||
/// - Message dialog:
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
@@ -130,14 +130,14 @@ impl<R: Runtime> Dialog<R> {
|
||||
///
|
||||
/// - Ask dialog:
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::{DialogExt, MessageDialogButtons};
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// app.dialog()
|
||||
/// .message("Are you sure?")
|
||||
/// .buttons(MessageDialogButtons::OkCancelCustom("Yes", "No"))
|
||||
/// .buttons(MessageDialogButtons::OkCancelCustom("Yes".to_string(), "No".to_string()))
|
||||
/// .show(|yes| {
|
||||
/// println!("user said {}", if yes { "yes" } else { "no" });
|
||||
/// });
|
||||
@@ -147,7 +147,7 @@ impl<R: Runtime> Dialog<R> {
|
||||
///
|
||||
/// - Message dialog with OK button:
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::{DialogExt, MessageDialogButtons};
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
@@ -169,7 +169,7 @@ impl<R: Runtime> Dialog<R> {
|
||||
/// To block the current thread until the user acted on the dialog, you can use `blocking_show`,
|
||||
/// but note that it cannot be executed on the main thread as it will freeze your application.
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::{DialogExt, MessageDialogButtons};
|
||||
///
|
||||
/// tauri::Builder::default()
|
||||
@@ -178,7 +178,7 @@ impl<R: Runtime> Dialog<R> {
|
||||
/// std::thread::spawn(move || {
|
||||
/// let yes = handle.dialog()
|
||||
/// .message("Are you sure?")
|
||||
/// .buttons(MessageDialogButtons::OkCancelCustom("Yes", "No"))
|
||||
/// .buttons(MessageDialogButtons::OkCancelCustom("Yes".to_string(), "No".to_string()))
|
||||
/// .blocking_show();
|
||||
/// });
|
||||
///
|
||||
@@ -532,7 +532,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
@@ -559,7 +559,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
/// The file paths cannot be read directly on Android as they are behind a content URI.
|
||||
/// The recommended way to read the files is using the [`fs`](https://v2.tauri.app/plugin/file-system/) plugin:
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// use tauri_plugin_fs::FsExt;
|
||||
/// tauri::Builder::default()
|
||||
@@ -580,7 +580,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
@@ -604,7 +604,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
@@ -629,7 +629,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
@@ -654,7 +654,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
@@ -681,7 +681,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// #[tauri::command]
|
||||
/// async fn my_command(app: tauri::AppHandle) {
|
||||
@@ -703,7 +703,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// #[tauri::command]
|
||||
/// async fn my_command(app: tauri::AppHandle) {
|
||||
@@ -725,7 +725,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// #[tauri::command]
|
||||
/// async fn my_command(app: tauri::AppHandle) {
|
||||
@@ -748,7 +748,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// #[tauri::command]
|
||||
/// async fn my_command(app: tauri::AppHandle) {
|
||||
@@ -771,7 +771,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_dialog::DialogExt;
|
||||
/// #[tauri::command]
|
||||
/// async fn my_command(app: tauri::AppHandle) {
|
||||
|
||||
@@ -30,6 +30,9 @@ serde = { workspace = true }
|
||||
toml = "1.0"
|
||||
tauri-utils = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tauri = { workspace = true, features = ["wry"] }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
+70
-24
@@ -125,11 +125,17 @@ impl OpenOptions {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_fs::OpenOptions;
|
||||
/// ```rust,no_run
|
||||
/// use std::path::Path;
|
||||
/// use tauri_plugin_fs::{FsExt, OpenOptions};
|
||||
///
|
||||
/// let mut options = OpenOptions::new();
|
||||
/// let file = options.read(true).open("foo.txt");
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// let mut options = OpenOptions::new();
|
||||
/// options.read(true);
|
||||
/// let file = app.fs().open(Path::new("foo.txt"), options)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
#[must_use]
|
||||
pub fn new() -> Self {
|
||||
@@ -143,10 +149,17 @@ impl OpenOptions {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_fs::OpenOptions;
|
||||
/// ```rust,no_run
|
||||
/// use std::path::Path;
|
||||
/// use tauri_plugin_fs::{FsExt, OpenOptions};
|
||||
///
|
||||
/// let file = OpenOptions::new().read(true).open("foo.txt");
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// let mut options = OpenOptions::new();
|
||||
/// options.read(true);
|
||||
/// let file = app.fs().open(Path::new("foo.txt"), options)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
pub fn read(&mut self, read: bool) -> &mut Self {
|
||||
self.read = read;
|
||||
@@ -163,10 +176,17 @@ impl OpenOptions {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_fs::OpenOptions;
|
||||
/// ```rust,no_run
|
||||
/// use std::path::Path;
|
||||
/// use tauri_plugin_fs::{FsExt, OpenOptions};
|
||||
///
|
||||
/// let file = OpenOptions::new().write(true).open("foo.txt");
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// let mut options = OpenOptions::new();
|
||||
/// options.write(true);
|
||||
/// let file = app.fs().open(Path::new("foo.txt"), options)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
pub fn write(&mut self, write: bool) -> &mut Self {
|
||||
self.write = write;
|
||||
@@ -217,10 +237,17 @@ impl OpenOptions {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_fs::OpenOptions;
|
||||
/// ```rust,no_run
|
||||
/// use std::path::Path;
|
||||
/// use tauri_plugin_fs::{FsExt, OpenOptions};
|
||||
///
|
||||
/// let file = OpenOptions::new().append(true).open("foo.txt");
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// let mut options = OpenOptions::new();
|
||||
/// options.append(true);
|
||||
/// let file = app.fs().open(Path::new("foo.txt"), options)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
pub fn append(&mut self, append: bool) -> &mut Self {
|
||||
self.append = append;
|
||||
@@ -236,10 +263,17 @@ impl OpenOptions {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_fs::OpenOptions;
|
||||
/// ```rust,no_run
|
||||
/// use std::path::Path;
|
||||
/// use tauri_plugin_fs::{FsExt, OpenOptions};
|
||||
///
|
||||
/// let file = OpenOptions::new().write(true).truncate(true).open("foo.txt");
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// let mut options = OpenOptions::new();
|
||||
/// options.write(true).truncate(true);
|
||||
/// let file = app.fs().open(Path::new("foo.txt"), options)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
pub fn truncate(&mut self, truncate: bool) -> &mut Self {
|
||||
self.truncate = truncate;
|
||||
@@ -254,10 +288,17 @@ impl OpenOptions {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_fs::OpenOptions;
|
||||
/// ```rust,no_run
|
||||
/// use std::path::Path;
|
||||
/// use tauri_plugin_fs::{FsExt, OpenOptions};
|
||||
///
|
||||
/// let file = OpenOptions::new().write(true).create(true).open("foo.txt");
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// let mut options = OpenOptions::new();
|
||||
/// options.write(true).create(true);
|
||||
/// let file = app.fs().open(Path::new("foo.txt"), options)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
pub fn create(&mut self, create: bool) -> &mut Self {
|
||||
self.create = create;
|
||||
@@ -288,12 +329,17 @@ impl OpenOptions {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// use tauri_plugin_fs::OpenOptions;
|
||||
/// ```rust,no_run
|
||||
/// use std::path::Path;
|
||||
/// use tauri_plugin_fs::{FsExt, OpenOptions};
|
||||
///
|
||||
/// let file = OpenOptions::new().write(true)
|
||||
/// .create_new(true)
|
||||
/// .open("foo.txt");
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// let mut options = OpenOptions::new();
|
||||
/// options.write(true).create_new(true);
|
||||
/// let file = app.fs().open(Path::new("foo.txt"), options)?;
|
||||
/// Ok(())
|
||||
/// });
|
||||
/// ```
|
||||
pub fn create_new(&mut self, create_new: bool) -> &mut Self {
|
||||
self.create_new = create_new;
|
||||
|
||||
@@ -30,6 +30,9 @@ ios = { level = "full", notes = "" }
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tauri = { workspace = true, features = ["wry"] }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
@@ -26,6 +26,9 @@ tauri-plugin = { workspace = true, features = ["build"] }
|
||||
schemars = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tauri = { workspace = true, features = ["wry"] }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
@@ -29,6 +29,9 @@ tauri-plugin = { workspace = true, features = ["build"] }
|
||||
schemars = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tauri = { workspace = true, features = ["wry"] }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
@@ -31,6 +31,9 @@ ios = { level = "none", notes = "" }
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tauri = { workspace = true, features = ["wry"] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
||||
Reference in New Issue
Block a user