Skip to content

Commit

Permalink
test(rsjudge-utils): 🚚 replace trybuild with doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jisu-Woniu committed Jul 18, 2024
1 parent f95226f commit b89b278
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 88 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/building.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
uses: moonrepo/setup-rust@v1
with:
channel: stable
components: rust-src
bins: cargo-hack, cargo-deny, clippy-sarif, sarif-fmt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -58,7 +57,7 @@ jobs:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
- name: Run tests
run: cargo hack test --all-targets --each-feature --verbose --workspace
run: cargo hack test --each-feature --verbose --workspace
- name: Check dependency graph
run: cargo deny --all-features --workspace check
msrv:
Expand All @@ -74,7 +73,6 @@ jobs:
uses: moonrepo/setup-rust@v1
with:
channel: "1.77"
components: rust-src
bins: cargo-hack
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -97,7 +95,7 @@ jobs:
- name: Check for MSRV compliance
env:
TRYBUILD: overwrite
run: cargo hack test --rust-version --all-targets --each-feature --workspace
run: cargo hack test --rust-version --each-feature --verbose --workspace
pkg-deb:
runs-on: ubuntu-20.04
steps:
Expand Down
30 changes: 0 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/rsjudge-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ tokio = { workspace = true, features = ["process", "macros", "rt-multi-thread"]

[dev-dependencies]
anyhow = "1.0.86"
trybuild = "1.0.97"
24 changes: 24 additions & 0 deletions crates/rsjudge-utils/src/error_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,27 @@ macro_rules! log_if_error {
})
};
}

/// ```compile_fail
/// use std::fmt::Display;
///
/// use rsjudge_utils::log_if_error;
///
/// #[derive(Debug)]
/// struct S;
/// impl Display for S {
/// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
/// write!(f, "S")
/// }
/// }
///
/// impl S {
/// fn inspect_err<F: FnOnce(Self) -> Self>(self, f: F) -> Self {
/// f(self)
/// }
/// }
///
/// let _ = log_if_error!(S);
/// ```
#[cfg(doctest)]
pub struct LoggingOnNonResult;
22 changes: 0 additions & 22 deletions crates/rsjudge-utils/tests/cases/logging_on_non_result.rs

This file was deleted.

22 changes: 0 additions & 22 deletions crates/rsjudge-utils/tests/cases/logging_on_non_result.stderr

This file was deleted.

9 changes: 0 additions & 9 deletions crates/rsjudge-utils/tests/macro_test.rs

This file was deleted.

0 comments on commit b89b278

Please sign in to comment.