aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-01-11 13:25:16 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-01-11 13:25:16 +0100
commitdf0bb5053c17123166b87ec35796f75ff99b54be (patch)
tree7f278086abb67a296954d6c5386b063be9094a86
parent5e117c505a8a371af600409b0f7d5f61b6969a85 (diff)
downloadsylt-df0bb5053c17123166b87ec35796f75ff99b54be.tar.gz
test_file macro
-rw-r--r--src/main.rs19
1 files changed, 10 insertions, 9 deletions
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");
}