turbo-crates-testing-proc-macros

Crates.ioturbo-crates-testing-proc-macros
lib.rsturbo-crates-testing-proc-macros
version0.0.2
sourcesrc
created_at2023-04-15 21:38:52.598342
updated_at2023-04-15 22:43:59.628187
descriptionturbo-crates testing proc macros
homepage
repositoryhttps://github.com/ariva/turbo-crates.git
max_upload_size
id840208
size5,896
Arunas Ivanauskas (ariva)

documentation

README

Turbo Crates Testing Proc Macros

Macros

  • safe_tests - Mark a module of tests as "safe"
  • safe_test - Mark which test will be "safe"

Example

use turbo_crates::testing::proc_macros::*;

#[cfg(test)]
#[safe_tests]
pub(crate) mod test {
    const TEST_ENV_VAR: &str = "TEST_ENV_VAR";

    #[test]
    #[safe_test]
    fn it_works1() {
        std::env::set_var(TEST_ENV_VAR, "test1");
        let test_value = std::env::var(TEST_ENV_VAR).unwrap();
        assert_eq!(test_value, "test1");
    }
    #[test]
    #[safe_test]
    fn it_works2() {
        std::env::set_var(TEST_ENV_VAR, "test2");
        let test_value = std::env::var(TEST_ENV_VAR).unwrap();
        assert_eq!(test_value, "test2");
    }
    #[test]
    #[safe_test]
    fn it_works3() {
        std::env::set_var(TEST_ENV_VAR, "test3");
        let test_value = std::env::var(TEST_ENV_VAR).unwrap();
        assert_eq!(test_value, "test3");
    }
    #[test]
    #[safe_test]
    fn it_works4() {
        std::env::set_var(TEST_ENV_VAR, "test4");
        let test_value = std::env::var(TEST_ENV_VAR).unwrap();
        assert_eq!(test_value, "test4");
    }
}
Commit count: 14

cargo fmt