Пример #1
0
def test_parameter__no_link(empty_generating_api):
    ref = TypeRef("lang")
    ref.name = "MyType"
    ref.prefix = "const "
    ref.suffix = " &"
    ref.id = "lang-tomtom_1_MyType"

    param = Parameter()
    param.type = ref
    param.name = "arg"

    helper = TemplateHelper(empty_generating_api)
    assert helper.parameter(param, link=False) == "const MyType & arg"
Пример #2
0
def test_parameter__no_name(empty_generating_api):
    ref = TypeRef("lang")
    ref.name = "MyType"
    ref.prefix = "const "
    ref.suffix = " &"
    ref.id = "lang-tomtom_1_MyType"

    param = Parameter()
    param.type = ref
    param.name = ""

    helper = TemplateHelper(empty_generating_api)
    assert helper.parameter(
        param) == "const xref:lang-tomtom_1_MyType[++MyType++] &"
Пример #3
0
def test_parameter__default_value(empty_generating_api):
    ref = TypeRef("lang")
    ref.name = "MyType"
    ref.prefix = "const "
    ref.suffix = " &"
    ref.id = "lang-tomtom_1_MyType"

    param = Parameter()
    param.type = ref
    param.name = "arg"
    param.default_value = "12"

    helper = TemplateHelper(empty_generating_api)
    assert helper.parameter(
        param, default_value=True
    ) == "const xref:lang-tomtom_1_MyType[++MyType++] & arg = 12"