diff --git a/tests/block.rs b/tests/block.rs index e79300d..e1133cb 100644 --- a/tests/block.rs +++ b/tests/block.rs @@ -30,17 +30,3 @@ fn async_with_return() { Ok(Value::Integer(1)) ); } - -#[test] -fn root_returns_like_block() { - assert_eq!( - interpret( - " - return 1 - 1 + 1 - 3 - " - ), - Ok(Value::Integer(1)) - ); -} diff --git a/tests/root.rs b/tests/root.rs new file mode 100644 index 0000000..a817599 --- /dev/null +++ b/tests/root.rs @@ -0,0 +1,29 @@ +use dust_lang::*; + +#[test] +fn returns_final_statement() { + assert_eq!( + interpret( + " + 1 + 1 + 1 + 3 + " + ), + Ok(Value::Integer(3)) + ); +} + +#[test] +fn return_statement() { + assert_eq!( + interpret( + " + return 1 + 1 + 1 + 3 + " + ), + Ok(Value::Integer(1)) + ); +}