Mercurial > hg
diff rust/hg-core/src/copy_tracing.rs @ 46658:fa21633af201
copies-rust: add a macro-based unit-testing framework
`compare_values`, `merge_copies_dict`, and `CombineChangesetCopies`
are APIs whose signatures involve non-trivial types.
Calling them directly in unit tests would involve a lot of verbose
setup code that obscures the meaningful parts of a given test case.
This adds a macro-based test-harness with pseudo-syntax to tersely
create arguments and expected return values in the correct types.
For now there is only one (not particularly meaningful) test case
per tested function, just to exercize the macros.
Differential Revision: https://phab.mercurial-scm.org/D10071
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 11 Jan 2021 13:33:00 +0100 |
parents | f977a065c7c2 |
children | 321e2b7bc95c |
line wrap: on
line diff
--- a/rust/hg-core/src/copy_tracing.rs Wed Jan 06 23:11:59 2021 +0100 +++ b/rust/hg-core/src/copy_tracing.rs Mon Jan 11 13:33:00 2021 +0100 @@ -1,3 +1,10 @@ +#[cfg(test)] +#[macro_use] +mod tests_support; + +#[cfg(test)] +mod tests; + use crate::utils::hg_path::HgPath; use crate::utils::hg_path::HgPathBuf; use crate::Revision;