Crates.io | asmov-testing |
lib.rs | asmov-testing |
version | 2.1.4 |
source | src |
created_at | 2024-06-05 18:13:27.825769 |
updated_at | 2024-06-14 22:06:08.772034 |
description | Creates a backup .bak copy of a file |
homepage | https://github.com/asmov/common/tree/dev/testing |
repository | https://github.com/asmov/common |
max_upload_size | |
id | 1263036 |
size | 143,200 |
A toolkit for organized testing in Rust.
#[cfg(test)]
mod tests {
use std::fs;
use asmov_testing::{self as testing, prelude::*};
static TESTING: testing::StaticModule = testing::module(|| {
testing::integration(module_path!())
.using_temp_dir()
.using_fixture_dir()
.setup(|module| {
let tmp_file = module.temp_dir()
.join("hello.txt");
fs::write(&tmp_file,
"Hello, Temp").unwrap();
})
.teardown_static(teardown)
.build()
});
extern fn teardown() {
println!("Farewell, sweet test run");
}
#[named]
#[test]
fn test_things() {
let test = TESTING.test(function_name!())
.using_fixture_dir()
.inherit_temp_dir()
.build();
let temp_file = test.temp_dir()
.join("hello.txt");
let temp_text = fs::read_to_string(temp_file)
.unwrap();
assert_eq!("Hello, Temp", temp_text);
let fixture_file = test.fixture_dir()
.join("sample.txt");
let _fixture_text = fs::read_to_string(fixture_file)
.unwrap();
assert_eq!("Hello, Fixture", _fixture_text);
}
}
Refer to docs.rs/asmov-testing
Asmov Testing: A toolkit for organized testing in Rust
Copyright (C) 2023 Asmov LLC
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Our library publically exports the named macro from Daniel Henry-Mantilla's crate: function_name. It is available for use from our crate as
asmov_testing::named
.
License (MIT):
Copyright (c) 2019 Daniel Henry-Mantilla