From df0bb5053c17123166b87ec35796f75ff99b54be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 11 Jan 2021 13:25:16 +0100 Subject: test_file macro --- src/main.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index c60dea1..dc4b14c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,15 +35,16 @@ mod tests { use super::run_file; use std::path::Path; - #[test] - fn order_of_operations() { - let file = Path::new("tests/order-of-operations.tdy"); - assert!(run_file(&file).is_ok()); + macro_rules! test_file { + ($fn:ident, $path:literal) => { + #[test] + fn $fn() { + let file = Path::new($path); + assert!(run_file(&file).is_ok()); + } + }; } - #[test] - fn variables() { - let file = Path::new("tests/variables.tdy"); - assert!(run_file(&file).is_ok()); - } + test_file!(order_of_operations, "tests/order-of-operations.tdy"); + test_file!(variables, "tests/variables.tdy"); } -- cgit v1.2.1