Skip to content

Commit b89b278

Browse files
committed
test(rsjudge-utils): 🚚 replace trybuild with doctests
1 parent f95226f commit b89b278

File tree

7 files changed

+26
-88
lines changed

7 files changed

+26
-88
lines changed

.github/workflows/building.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
uses: moonrepo/setup-rust@v1
2424
with:
2525
channel: stable
26-
components: rust-src
2726
bins: cargo-hack, cargo-deny, clippy-sarif, sarif-fmt
2827
env:
2928
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -58,7 +57,7 @@ jobs:
5857
sarif_file: rust-clippy-results.sarif
5958
wait-for-processing: true
6059
- name: Run tests
61-
run: cargo hack test --all-targets --each-feature --verbose --workspace
60+
run: cargo hack test --each-feature --verbose --workspace
6261
- name: Check dependency graph
6362
run: cargo deny --all-features --workspace check
6463
msrv:
@@ -74,7 +73,6 @@ jobs:
7473
uses: moonrepo/setup-rust@v1
7574
with:
7675
channel: "1.77"
77-
components: rust-src
7876
bins: cargo-hack
7977
env:
8078
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -97,7 +95,7 @@ jobs:
9795
- name: Check for MSRV compliance
9896
env:
9997
TRYBUILD: overwrite
100-
run: cargo hack test --rust-version --all-targets --each-feature --workspace
98+
run: cargo hack test --rust-version --each-feature --verbose --workspace
10199
pkg-deb:
102100
runs-on: ubuntu-20.04
103101
steps:

Cargo.lock

Lines changed: 0 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/rsjudge-utils/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ tokio = { workspace = true, features = ["process", "macros", "rt-multi-thread"]
1717

1818
[dev-dependencies]
1919
anyhow = "1.0.86"
20-
trybuild = "1.0.97"

crates/rsjudge-utils/src/error_macros.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,27 @@ macro_rules! log_if_error {
2424
})
2525
};
2626
}
27+
28+
/// ```compile_fail
29+
/// use std::fmt::Display;
30+
///
31+
/// use rsjudge_utils::log_if_error;
32+
///
33+
/// #[derive(Debug)]
34+
/// struct S;
35+
/// impl Display for S {
36+
/// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
37+
/// write!(f, "S")
38+
/// }
39+
/// }
40+
///
41+
/// impl S {
42+
/// fn inspect_err<F: FnOnce(Self) -> Self>(self, f: F) -> Self {
43+
/// f(self)
44+
/// }
45+
/// }
46+
///
47+
/// let _ = log_if_error!(S);
48+
/// ```
49+
#[cfg(doctest)]
50+
pub struct LoggingOnNonResult;

crates/rsjudge-utils/tests/cases/logging_on_non_result.rs

Lines changed: 0 additions & 22 deletions
This file was deleted.

crates/rsjudge-utils/tests/cases/logging_on_non_result.stderr

Lines changed: 0 additions & 22 deletions
This file was deleted.

crates/rsjudge-utils/tests/macro_test.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)