From 128ddc385cf9378c8dae628bac1e5a36ed1b36eb Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 31 Dec 2023 18:14:00 -0500 Subject: [PATCH] Add test for match example --- examples/match.ds | 4 ++-- tests/dust_examples.rs | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/match.ds b/examples/match.ds index 48bb8a2..a2ab2ca 100644 --- a/examples/match.ds +++ b/examples/match.ds @@ -1,9 +1,9 @@ -foo_or_bar = match (random_boolean) { +foo_or_bar = match random_boolean() { true => "foo" false => "bar" } -num = match (random_integer) { +num = match random_integer() { 1 => "one", 2 => { "two" }, * => "neither", diff --git a/tests/dust_examples.rs b/tests/dust_examples.rs index aaae467..c1b6845 100644 --- a/tests/dust_examples.rs +++ b/tests/dust_examples.rs @@ -81,6 +81,13 @@ fn map() { interpret(&file_contents).unwrap(); } +#[test] +fn r#match() { + let file_contents = read_to_string("examples/match.ds").unwrap(); + + interpret(&file_contents).unwrap(); +} + #[test] fn random() { let file_contents = read_to_string("examples/random.ds").unwrap();