test: cover typed unknown method fields
This commit is contained in:
@@ -180,6 +180,16 @@ class ValidateTypecheckDiagnosticsTests(unittest.TestCase):
|
||||
MODULE.EXPECTED,
|
||||
)
|
||||
|
||||
def test_includes_typed_method_unknown_field_diagnostics(self):
|
||||
self.assertIn(
|
||||
"tests/typecheck_method_unknown_field_typed_bad.claro",
|
||||
MODULE.EXPECTED,
|
||||
)
|
||||
self.assertIn(
|
||||
"tests/typecheck_method_compat_unknown_field_typed_bad.claro",
|
||||
MODULE.EXPECTED,
|
||||
)
|
||||
|
||||
def test_includes_method_text_field_assignment_diagnostic_fixture(self):
|
||||
self.assertIn(
|
||||
"tests/typecheck_method_text_field_assignment_bad.claro",
|
||||
@@ -262,6 +272,8 @@ class ValidateTypecheckDiagnosticsTests(unittest.TestCase):
|
||||
"tests/typecheck_method_compat_yesno_field_assignment_bad.claro",
|
||||
"tests/typecheck_method_field_check_type_bad.claro",
|
||||
"tests/typecheck_method_compat_unknown_field_bad.claro",
|
||||
"tests/typecheck_method_unknown_field_typed_bad.claro",
|
||||
"tests/typecheck_method_compat_unknown_field_typed_bad.claro",
|
||||
):
|
||||
self.assertIn(f'"{fixture}"', source)
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
CLASS Player
|
||||
HAS score NUMBER
|
||||
TEACH set_level TAKES nothing
|
||||
SET level NUMBER 3
|
||||
LEARNED
|
||||
ENDCLASS
|
||||
|
||||
NEW Player player
|
||||
CALL player.set_level WITH 0
|
||||
@@ -0,0 +1,9 @@
|
||||
CLASS Player
|
||||
HAS score NUMBER
|
||||
TEACH set_level
|
||||
SET level NUMBER 3
|
||||
END
|
||||
END
|
||||
|
||||
NEW Player player
|
||||
DO player.set_level
|
||||
Reference in New Issue
Block a user