libtmux Reference MCP Search
On this page

test.TestServer.session

View as Markdown

Module
test
Declared in
TestServer
Package
libtmux
Source
crates/libtmux/src/test.rs
session ( self , options : impl Into<crate::NewSessionOptions> ) Result<crate::Session, crate::Error>
method [source]
method [source]
session

Create a session on this fixture's server.

A test almost always wants a session before it wants anything else, and reaching through TestServer::server to say so is noise. Takes the same options crate::Server::new_session does, so a test that needs a start directory or a window name says it here rather than dropping back to the server.

Errors

Returns the error tmux gave, including crate::Error::SessionExists when the name is taken.

Examples

let guard = libtmux::test::TestServer::new().await?;
let session = guard.session("work").await?;

assert_eq!(session.name().as_bytes(), b"work");

guard.shutdown().await?;

0 declared, 0 inherited

Esc

Type to search.