Beispiel #1
0
def driver():
    yield wait_tasks(other_than=known_tasks)

    msgs = GPS.Console().get_text()
    if "undefined external" in msgs:
        simple_error(
            "The console shows a project load issue:\n{}".format(msgs))
Beispiel #2
0
def driver():
    # type 'foo' in the omnisearch
    yield wait_tasks()
    w = pygps.get_widget_by_name('global_search')
    w.get_toplevel().grab_focus()
    yield wait_idle()
    w.grab_focus()
    yield wait_idle()
    w.set_text("foo")
    yield timeout(1000)
    popup = pygps.get_widget_by_name('global_search-results-list')
    results_tree = pygps.get_widgets_by_type(Gtk.TreeView, popup)[0]

    # select "foo.adb" file
    click_in_tree(results_tree, path="0", column=1)
    yield timeout(1000)
    if not GPS.EditorBuffer.get().file().name().endswith("foo.adb"):
        simple_error("foo.adb is not opened")

    #  retype 'foo' in the omnisearch
    w.get_toplevel().grab_focus()
    yield wait_idle()
    w.grab_focus()
    yield wait_idle()
    w.set_text("foo")
    yield timeout(1000)

    # check whether we have result from the History provider
    popup = pygps.get_widget_by_name('global_search-results-list')
    results_tree = pygps.get_widgets_by_type(Gtk.TreeView, popup)[0]
    result = dump_tree_model(results_tree.get_model(), 3)

    gps_assert("History (1)" in result,
               True,
               "wrong omnisearch result")
Beispiel #3
0
def do_exit(timeout):
    """ Force an exit of GPS right now, logging as an error the contents
        of the Messages window. This is useful for capturing more traces
        for stalled tests that are about to get killed by rlimit.
    """
    timeout.remove()
    simple_error(GPS.Console("Messages").get_text())
    GPS.exit(force=1)
Beispiel #4
0
def driver():
    als = GPS.LanguageServer.get_by_language_name("Ada")

    params = {}
    result = yield als.request_promise("textDocument/unknown_request", None)

    if not result.is_error:
        simple_error("we were expecting an error response")
Beispiel #5
0
def driver():
    als = GPS.LanguageServer.get_by_language_name("Ada")

    params = {}
    result = yield als.request_promise("textDocument/unknown_request", None)

    if not result.is_error:
        simple_error("we were expecting an error response")
    msg = GPS.Console("Messages").get_text()

    if "The language server has reported the following error" not in msg:
        simple_error("error response must be displayed in Messages view")
Beispiel #6
0
Datei: test.py Projekt: gspu/gps
def driver():
    p = GPS.Project.root()

    t = GPS.BuildTarget("Build All")

    t.execute()
    if "-Xmy_variable" in GPS.Console().get_text():
        simple_error("-X shouldn't contain 'my_variable' "
                     "when it has the default value")

    p.set_scenario_variable("my_variable", "other_value")

    t.execute()
    if "-Xmy_variable" not in GPS.Console().get_text():
        simple_error("-X should show 'my_variable' now")

    # Reset to default value
    p.set_scenario_variable("my_variable", "default_value")
Beispiel #7
0
def driver():
    # Generate a giant file on disk and load it from disk
    with open("p.ads", "wb") as f:
        f.write("""package P is
   function Foo return Integer is (42);
end P;""" + ("--" + "spam" * 100 + "\n") * 10000)

    # Reload the project so that p.ads is considered as a source
    GPS.execute_action("reload project")

    q_ads = GPS.File("q.ads")
    p_ads = GPS.File("p.ads")
    a = GPS.EditorBuffer.get(p_ads)
    yield timeout(1000)
    b = GPS.EditorBuffer.get(q_ads)

    # Now insert a huge amount of data in an already open editor
    b.insert(b.at(4, 7), ("--  " + "spam" * 100 + "\n") * 10000)

    als = GPS.LanguageServer.get_by_language_name("Ada")

    params = {"textDocument": {"uri": q_ads.uri},
              "position": {"line": 2, "character": 27},
              "context": {"includeDeclaration": True}}

    result = yield als.request_promise("textDocument/references", params)

    if not result.is_valid:
        simple_error("we were expecting a valid result")

    # The result we expect from find_all_references
    expected = [{"uri": p_ads.uri,
                 "range": {"start": {"line": 1, "character": 12},
                           "end": {"line": 1, "character": 15}},
                 "alsKind": ["reference"]},
                {"uri": q_ads.uri,
                 "range": {"start": {"line": 2, "character": 27},
                           "end": {"line": 2, "character": 30}},
                 "alsKind": ["call"]}]

    gps_assert(
        result.data, expected,
        "result contents doesn't match expectations: {}".format(result))
Beispiel #8
0
def driver():
    GPS.execute_action("open Scenario")
    msgs = GPS.Console().get_text()
    if UNDEFINED_EXTERNALS_MSG not in msgs:
        simple_error("No warning message about undefined scenario variables"
                     " found in the messages view:\n{}".format(msgs))
Beispiel #9
0
def driver():
    GPS.execute_action("open Scenario")
    msgs = GPS.Console().get_text()
    if "a scenario variable named 'Bla' appears more than once" not in msgs:
        simple_error("we did not find the expected collision"
                     " warning in the messages view:\n{}".format(msgs))