示例#1
0
def add_completion_test(currtest, platformspecific=False, noneok=False):
    key = "%s-%s" % (currfile, currtest)
    add_test_ex(key, lambda: tu.cache.complete(currtest, ""), platformspecific, noneok)

    data = currfile_data
    if "{" not in currtest:
        data += "void __dummy__() {\n" + currtest
    else:
        data += currtest

    if currtest.startswith(currfile_data) or disableplatformspecific:
        # This is pretty much what we've already tested for the clangcomplete operation
        return
    data += " "
    row, col = parsehelp.get_line_and_column_from_offset(data, len(data)-1)
    def test():
        #complete = tu.cache.complete(currtest, "") or []
        memb = is_member_completion(data, len(data)-2)
        clangcomplete = tu.cache.clangcomplete(currfile, row, col, [(currfile,data)], memb)

        # for result in complete:
        #     print("complete: ", result)
        return clangcomplete

    add_test_ex(key + " (clangcomplete)", test, platformspecific, noneok)
示例#2
0
def add_completion_test(currtest, platformspecific=False, noneok=False):
    key = "%s-%s" % (currfile, currtest)
    add_test_ex(key, lambda: tu.cache.complete(currtest, ""), platformspecific, noneok)

    data = currfile_data
    if "{" not in currtest:
        data += "void __dummy__() {\n" + currtest
    else:
        data += currtest

    if currtest.startswith(currfile_data) or disableplatformspecific:
        # This is pretty much what we've already tested for the clangcomplete operation
        return
    data += " "
    row, col = parsehelp.get_line_and_column_from_offset(data, len(data)-1)
    def test():
        #complete = tu.cache.complete(currtest, "") or []
        memb = is_member_completion(data, len(data)-2)
        clangcomplete = tu.cache.clangcomplete(currfile, row, col, [(currfile,data)], memb)

        # for result in complete:
        #     print("complete: ", result)
        return clangcomplete

    add_test_ex(key + " (clangcomplete)", test, platformspecific, noneok)
示例#3
0
    def fixup(res):
        if res.startswith("Don't"):
            return res
        if res.count(":") == 2:
            name, line, col = res.split(":")
        else:
            name, line, col = res, 1, 1
        line, col = int(line), int(col)
        name = os.path.relpath(name)
        # Just to ensure uniform results on all platforms
        name = name.replace(os.path.sep, "/")
        d = data
        if name != "src/main.cpp":
            d = read_file(name)
        off = parsehelp.get_offset_from_line_and_column(d, line, col)
        l2, c2 = parsehelp.get_line_and_column_from_offset(d, off)

        return "%s:%d:%d - %s - %s" % (name, line, col, word, parsehelp.extract_line_at_offset(d, off))
示例#4
0
    def fixup(res):
        if res.startswith("Don't"):
            return res
        if res.count(":") == 2:
            name, line, col = res.split(":")
        else:
            name, line, col = res, 1, 1
        line, col = int(line), int(col)
        name = os.path.relpath(name)
        # Just to ensure uniform results on all platforms
        name = name.replace(os.path.sep, "/")
        d = data
        if name != "src/main.cpp":
            d = read_file(name)
        off = parsehelp.get_offset_from_line_and_column(d, line, col)
        l2, c2 = parsehelp.get_line_and_column_from_offset(d, off)

        return "%s:%d:%d - %s - %s" % (name, line, col, word, parsehelp.extract_line_at_offset(d, off))