Skip to main content

setup

Macro setup 

Source
macro_rules! setup {
    ($b:block) => { ... };
}
Expand description

Setup for unit test initialization.

§Argument

  • $b - code block for unit test initialization.

§Example

 use std::fs;
 use std::fs::File;
 use std::path::Path;
 use utmt::setup;

setup!({File::create(Path::new("aFile.txt")).unwrap();});

§Note

While setup!({...}) is using is advised to use teardown!({...}) after, like this example:

 use std::fs;
 use std::fs::File;
 use std::path::Path;
 use utmt::{setup, teardown};

setup!({File::create(Path::new("aFile.txt")).unwrap();});
teardown!({fs::remove_file(Path::new("aFile.txt")).unwrap();});
// ... test code