Ejemplo n.º 1
0
def test_objc_method_signature__class_method(context):
    method = Member("objc")
    method.name = "start"
    method.static = True
    method.returns = ReturnValue()
    method.returns.type = TypeRef("objc", name="void")
    assert objc_method_signature(method, context) == "+ (void)start"
Ejemplo n.º 2
0
def test_objc_method_signature__multiple_params_linked_return(context):
    method = Member("objc")
    method.name = "setValue:withUnit:andALongerParam:"
    method.returns = ReturnValue()
    method.returns.type = TypeRef("objc", name="Value")
    method.returns.type.id = "objc-value"

    param1 = Parameter()
    param1.name = "arg1"
    param1.type = TypeRef("objc", "Type1")

    param2 = Parameter()
    param2.name = "arg2"
    param2.type = TypeRef("objc", "Type2")
    param2.type.id = "objc-type2"

    param3 = Parameter()
    param3.name = "arg3"
    param3.type = TypeRef("objc", "Type3")

    method.params = [param1, param2, param3]

    assert (objc_method_signature(
        method, context) == "- (xref:objc-value[Value])setValue:(Type1)arg1\n"
            "         withUnit:(xref:objc-type2[Type2])arg2\n"
            "  andALongerParam:(Type3)arg3")
Ejemplo n.º 3
0
def test_objc_method_signature__no_params_link_return(context):
    method = Member("objc")
    method.name = "retrieveValue"
    method.returns = ReturnValue()
    method.returns.type = TypeRef("objc", name="Value")
    method.returns.type.id = "objc-value"
    assert objc_method_signature(
        method, context) == "- (xref:objc-value[Value])retrieveValue"
Ejemplo n.º 4
0
def test_objc_method_signature__one_param(context):
    method = Member("objc")
    method.name = "setValue:"
    method.returns = ReturnValue()
    method.returns.type = TypeRef("objc", name="Value")
    method.returns.type.id = "objc-value"

    param1 = Parameter()
    param1.name = "arg1"
    param1.type = TypeRef("objc", "Type1")
    method.params = [param1]

    assert objc_method_signature(
        method, context) == "- (xref:objc-value[Value])setValue:(Type1)arg1"
Ejemplo n.º 5
0
def test_objc_method_signature__no_params_simple_return(context):
    method = Member("objc")
    method.name = "start"
    method.returns = ReturnValue()
    method.returns.type = TypeRef("objc", name="void")
    assert objc_method_signature(method, context) == "- (void)start"