TestServer.session
Create a session on this fixture's server.
Source and package
- Qualified name
-
libtmux::test:: Test Server:: session - Module
- test
- Declared in
TestServer- Package
- libtmux
- Source
- crates/libtmux/src/test.rs
- pub async fn session( &self, options: impl Into<crate::
New >, ) -> Result<crate::Session Options Session , crate::Error > -
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 optionscrate::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::SessionExistswhen 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
-
-
options(impl Into<crate::New >) #Session Options
-