From 0c0583a93a93edbbeb0995f6d59fa47bc6f0b0b2 Mon Sep 17 00:00:00 2001 From: Kris Katterjohn Date: Sat, 15 Jun 2024 16:49:12 -0400 Subject: [PATCH] Add some more tests for go/return to rtest_translator --- tests/rtest_translator.mac | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/rtest_translator.mac b/tests/rtest_translator.mac index 4d5cee798..b7dd1431d 100644 --- a/tests/rtest_translator.mac +++ b/tests/rtest_translator.mac @@ -3135,6 +3135,50 @@ true; (kill (foo, bar, baz), 0); 0; +/* Basic tests for error checking of translated return and go forms */ + +(foo () := return (), + translate (foo)); +[]; + +(foo () := do return (1), + translate_or_lose (foo), + foo ()); +1; + +(foo () := block (return (2)), + translate_or_lose (foo), + foo ()); +2; + +(foo () := go (x), + translate (foo)); +[]; + +(foo () := block (go (f ())), + translate (foo)); +[]; + +/* *cough* */ +(foo () := do (go (1), return (false), 1, return (true)), + translate_or_lose (foo), + foo ()); +true; + +/* *cough* */ +(foo () := block (block (go (x)), return (1), go (x), return (2), x, 3), + translate_or_lose (foo), + foo ()); +3; + +(foo () := block (go (end), return (0), end, 1), + translate_or_lose (foo), + foo ()); +1; + +(kill (foo), 0); +0; + -- 2.11.4.GIT