-
Notifications
You must be signed in to change notification settings - Fork 27
Description
In recent PRs we've started using the DummyArkFrontend infrastructure for protocol-level tests of comms:
- Synchronise Positron's Variables pane with debug environment #1052 (variables)
- Notify Variables pane when frame is selected #1060 (data explorer and variables)
- Add plot file/origin attribution #1067 (plots)
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
). We can let the normal operation of the kernel generate this sort of events.ark/crates/ark/tests/variables.rs
Line 116 in 239ee7e
EVENTS.environment_changed.emit(()); -
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:
ark/crates/ark/tests/variables.rs
Lines 109 to 113 in 239ee7e
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.