Skip to content

Commit

Permalink
Add: Minimal reproducible issue eupn#74
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Van de Vyver <[email protected]>
  • Loading branch information
taqtiqa-mark committed Mar 10, 2024
1 parent 730f13f commit a39a753
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 4 deletions.
6 changes: 6 additions & 0 deletions test-virtual/wrkspc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ inventory = "0.2.2"
name = "integration-tests"
path = "integration/main.rs"
harness = false

[[test]]
name = "defaults-indev-tokio"
path = "integration/feature.rs"
harness = false
required-features = ["test-feature"]
4 changes: 4 additions & 0 deletions test-virtual/wrkspc-test/integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ fn setup() {
fn teardown() {
println!("Teardown")
}
// NOTE:
// When this code is in src/main.rs, it is executed by `cargo test -- --list`.
// In such cases you could guard it:
// #[cfg(feature = "integration")]
fn main() {
// Setup test environment
setup();
Expand Down
8 changes: 4 additions & 4 deletions test-virtual/wrkspc-test/integration/tests/basic.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use super::IntegrationTest;
use crate::tests::IntegrationTest;

fn basic_test() {
println!("Running basic test")
println!("Running basic test")
}

inventory::submit!(IntegrationTest {
name: "basic",
test_fn: basic_test
name: "basic",
test_fn: basic_test
});
47 changes: 47 additions & 0 deletions test-virtual/wrkspc-test/integration/tests/feature.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
use crate::tests::IntegrationTest;

fn feature_test() {
println!("Running feature test")
}

inventory::submit!(IntegrationTest {
name: "feature",
test_fn: feature_test
});

pub fn pass_args() {
macrotest::expand_args(
"integration/tests/feature/expanded/*.rs",
&["--features", "test-feature"],
);
}
inventory::submit!(IntegrationTest {
name: "feature",
test_fn: pass_args
});

pub fn pass_expect_expanded_args() {
// If you delete one of the `.expanded.rs` files, this test will fail.
macrotest::expand_args(
"integration/tests/feature/expanded/*.rs",
&["--features", "test-feature"],
);
}
inventory::submit!(IntegrationTest {
name: "feature",
test_fn: feature_test
});

// Suspended panicky tests for the moment
//
// pub fn fail_expect_expanded_args() {
// // This directory doesn't have expanded files but since they're expected, the test will fail.
// macrotest::expand_without_refresh_args(
// "integration/tests/feature/unchanged/*.rs",
// &["--features", "test-feature"],
// );
// }
// inventory::submit!(IntegrationTest {
// name: "feature",
// test_fn: fail_expect_expanded_args
// });
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extern crate std;
#[macro_use]
extern crate test_project;
pub fn main() {
{
let mut temp_vec = Vec::new();
temp_vec.push(1);
temp_vec.push(2);
temp_vec.push(3);
temp_vec
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#![cfg(feature = "test-feature")]

#[macro_use]
extern crate test_project;

pub fn main() {
test_feature_vec![1, 2, 3];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#![cfg(feature = "test-feature")]

#[macro_use]
extern crate test_project;

pub fn main() {
test_feature_vec![1, 2, 3];
}
1 change: 1 addition & 0 deletions test-virtual/wrkspc-test/integration/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod basic;
pub mod feature;

#[derive(Debug)]
pub struct IntegrationTest {
Expand Down

0 comments on commit a39a753

Please sign in to comment.