@@ -401,6 +401,38 @@ The tests cover:
401401Optional fields (` resize ` , ` activate ` , ` health ` ) are only tested when the backend provides them. A
402402backend that omits ` resize ` entirely will not see resize tests.
403403
404+ ### Helpers
405+
406+ In addition to offering ` smart-splits.protocol_tests ` for protocol correctness tests, the core plugin also
407+ offers various helper functions that may be useful for writing backend tests, such as:
408+
409+ ``` lua
410+ -- ensure that `smart-splits.nvim/tests/` is added to your runtimepath
411+ -- in your Busted `init.lua`, e.g. if your test job clones the core plugin
412+ -- under `./deps/` then:
413+ vim .opt .rtp :append (' ./deps/smart-splits.nvim/tests' )
414+
415+ -- Then, in your tests, you can use:
416+ local helpers = require (' tests.helpers' )
417+
418+ -- Reset smart-splits.nvim's plugin config, loaded backend, and logging instance
419+ helpers .reset_plugin ()
420+ -- Reset editor layout
421+ helpers .reset_editor ()
422+ -- Reset editor layout, then create `n` vertical splits
423+ helpers .create_vsplits (n )
424+ -- Same for horizontal splits
425+ helpers .create_hsplits (n )
426+ -- Focus `win`
427+ helpers .focus (win )
428+ -- Get active window
429+ helpers .curwin ()
430+ -- Give each provided window ID a unique buffer inside it
431+ helpers .unique_buffers (wins )
432+
433+ -- And more! See `./tests/helpers.lua`
434+ ```
435+
404436## What core does not give you
405437
406438- ** Pane identifiers.** Core no longer asks for them, and no longer compares them to work out whether
0 commit comments