test: cover typed method return expressions

This commit is contained in:
Hermes Agent
2026-09-09 05:50:44 +00:00
parent 57246c7a47
commit 465f3f4d26
8 changed files with 24 additions and 4 deletions
@@ -50,6 +50,10 @@ class ValidateTypecheckDiagnosticsTests(unittest.TestCase):
def test_includes_missing_method_return_fixture(self):
self.assertIn("tests/typecheck_method_missing_return_bad.claro", MODULE.EXPECTED)
def test_includes_typed_method_return_expression_fixtures(self):
self.assertIn("tests/typecheck_method_return_expression_bad.claro", MODULE.EXPECTED)
self.assertIn("tests/typecheck_method_return_expression_good.claro", MODULE.EXPECTED_OK)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,6 @@
CLASS Player
TEACH label amount RETURNS TEXT
CHECK TYPE amount IS NUMBER
RETURN amount + 1
END
END
@@ -0,0 +1,6 @@
CLASS Player
TEACH label amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount + 1
END
END