Core Library0.xGuides

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice
Edit this page on GitHub

Testing with libtmux

Needs libtmux for C++ 0.x Install

The complete capture program uses libtmux::test::ScopedTmuxServer to own a private server and report teardown failures. It includes the public testing header and links the testing library explicitly in its CMake setup.

This fixture is temporary example scaffolding. In an application, use the regular Server connected to the server you manage. Future versions of that example will use the regular server object directly.

Run a complete example

Capture pane output includes a complete C++ executable, imports, dependency setup and cleanup. Its output check fails when the expected line does not arrive before the deadline. Start with that program when adapting the pattern to your own test runner.

Keep server ownership explicit

Give each test a private socket and a known tmux configuration. Stop the server the test creates, including when startup or an assertion fails. Preserve the original failure and report cleanup errors so a leaked server remains visible.

A connection to an existing server has a different lifetime. The attach program leaves that server running. When it starts a private server of its own, it stops only that one.

Wait for the state you assert

Wait for the actual output or completion condition with a deadline. Sending keys returning successfully does not establish that the application finished. Capturing output explains the difference between a screen snapshot and a stream of output.

Esc
Search in

Type to search.

Reference previewOpen reference