Skip to content

Migrate existing comm tests to protocol-level tests #1074

@lionel-

Description

@lionel-

In recent PRs we've started using the DummyArkFrontend infrastructure for protocol-level tests of comms:

These tests are much nicer and effective than the old comm-based legacy tests because:

  • They exercise the whole kernel. This means that there is no need to simulate environment changed events after modifying the global env, which requires knowing a deeper knowledge of how internals work to produce a meaningful test (see

    EVENTS.environment_changed.emit(());
    ). We can let the normal operation of the kernel generate this sort of events.

  • It allows testing comms in conjunction with DAP and LSP operations and state. For instance the DAP now triggers comm-visible events, and it's nice to exercise these paths.

  • Inputs to the tests can be modelled after user requests, such as executing R code in the console. Compare to how we simulate global environment changes for Variables pane tests:

    r_task(|| unsafe {
    let test_env = test_env.get().clone();
    let sym = r_symbol!("everything");
    Rf_defineVar(sym, Rf_ScalarInteger(42), *test_env);
    });

Before doing that though, we should solve #689. This will allow comms to behave deterministically and tested with sequential assertions that are much stronger than fuzzy matching of events.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions