Johan B.W. de Vries ff0286bcf6 More framework
2023-11-11 13:45:03 +01:00

817 B

module_constant_def_ok

As a developer I want to define $TYPE module constants In order to make hardcoded values more visible and to make it easier to change hardcoded values

CONSTANT: $TYPE = $VAL0

@exported
def testEntry() -> i32:
    return 9
expect(9)

module_constant_def_bad

As a developer I want to receive a type error on an invalid assignment on a $TYPE module constant In order to make debugging easier

CONSTANT: $OTHER_TYPE = $VAL0

@exported
def testEntry() -> i32:
    return 0
if TYPE_NAME.startswith('tuple_'):
    expect_type_error(
        'Tuple element count mismatch',
        'The given literal must fit the expected type',
    )
else:
    expect_type_error(
        'Must be tuple',
        'The given literal must fit the expected type',
    )