From 5e117c505a8a371af600409b0f7d5f61b6969a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 11 Jan 2021 13:17:06 +0100 Subject: variable tests --- src/main.rs | 6 ++++++ tests/variables.tdy | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/variables.tdy diff --git a/src/main.rs b/src/main.rs index 53e2e08..c60dea1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,4 +40,10 @@ mod tests { let file = Path::new("tests/order-of-operations.tdy"); assert!(run_file(&file).is_ok()); } + + #[test] + fn variables() { + let file = Path::new("tests/variables.tdy"); + assert!(run_file(&file).is_ok()); + } } diff --git a/tests/variables.tdy b/tests/variables.tdy new file mode 100644 index 0000000..62b30d2 --- /dev/null +++ b/tests/variables.tdy @@ -0,0 +1,17 @@ +// a variable +a int := 1 +a <=> 1 + +// another variable +b int := 2 +b <=> 2 + +// assignment +a = b +a <=> 2 + +// ordering +c int := 3 +d int := 4 +c <=> 3 +d <=> 4 -- cgit v1.2.1