Core Library0.xAPI Reference

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.

method libtmux-rs latest

TestServer.session

Create a session on this fixture's server.

Source and package
Qualified name
libtmux::test::TestServer::session
Module
test
Declared in
TestServer
Package
libtmux
Source
crates/libtmux/src/test.rs

Description#

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?;
Parameters
Esc

Type to search.

Reference previewOpen reference