Skip to content

Commit ff2fd24

Browse files
committed
chore: Move compile-fail tests
1 parent 882d8fa commit ff2fd24

File tree

16 files changed

+26
-92
lines changed

16 files changed

+26
-92
lines changed

crates/stackable-versioned-macros/fixtures/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Snapshot Testing
22

3+
> [!NOTE]
4+
> Also see the compile-fail tests, described [here](../tests/README.md).
5+
36
This folder contains fixtures for snapshot testing the `#[versioned()]` macro. Snapshot testing is
47
done using the [insta] crate. It provides a [CLI tool][insta-cli] called `cargo-insta` and a
58
[VS Code extension][insta-ext].
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Compile-Fail Testing
2+
3+
> [!NOTE]
4+
> Also see the snapshot tests, described [here](../fixtures/README.md).
5+
6+
This type of testing is part of UI testing. These tests assert two things: First, the code should
7+
**not** compile and secondly should also produce the expected rustc (compiler) error message. For
8+
this type of testing, we use the [`trybuild`][trybuild] crate.
9+
10+
Tests are currently separated into two folders: `default` and `k8s`. The default test cases don't
11+
require any additional features to be activated. The Kubernetes specific tests require the `k8s`
12+
feature to be enabled. These tests can be run with `cargo test --all-features`.
13+
14+
Further information about the workflow are described [here][workflow].
15+
16+
[workflow]: https://docs.rs/trybuild/latest/trybuild/#workflow
17+
[trybuild]: https://docs.rs/trybuild/latest/trybuild/

crates/stackable-versioned-macros/tests/default/fail/README.md

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

crates/stackable-versioned-macros/tests/enum.rs

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

crates/stackable-versioned-macros/tests/from.rs

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

crates/stackable-versioned-macros/tests/trybuild.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,26 @@
1616
// again but before running tests, otherwise compilation will fail (as expected).
1717
#[allow(dead_code)]
1818
mod default {
19-
// mod fail {
20-
// mod deprecate;
21-
// mod skip_from_all;
22-
// mod skip_from_version;
23-
// }
19+
// mod deprecate;
20+
// mod skip_from_all;
21+
// mod skip_from_version;
2422
}
2523

2624
#[test]
2725
fn default_macros() {
2826
let t = trybuild::TestCases::new();
29-
t.compile_fail("tests/default/fail/*.rs");
27+
t.compile_fail("tests/default/*.rs");
3028
}
3129

3230
#[cfg(feature = "k8s")]
3331
#[allow(dead_code)]
3432
mod k8s {
35-
// mod fail {
36-
// mod crd;
37-
// }
33+
// mod crd;
3834
}
3935

4036
#[cfg(feature = "k8s")]
4137
#[test]
4238
fn k8s_macros() {
4339
let t = trybuild::TestCases::new();
44-
t.compile_fail("tests/k8s/fail/*.rs");
40+
t.compile_fail("tests/k8s/*.rs");
4541
}

0 commit comments

Comments
 (0)