Repository navigation
feat(test): add unit and integration tests for mini_buffer, SSH session, and connection manager - #5
Merged
Conversation
Closed
…on, and connection manager - Move enable_testing() to top-level CMakeLists.txt for ctest discovery - Extract ssh_connection.cpp into webssh_cpp_ssh_lib static library for test reuse - Update test/CMakeLists.txt to link against webssh_cpp_ssh_lib - Implement ssh_pty_connection_manager::close_channel() (was declared but missing) - Add test/mini_buffer.test.cpp (8 test cases, 42 assertions) - Add test/ssh_session.test.cpp (13 test cases, 14 assertions) - Add test/ssh_connection.test.cpp (9 integration test cases, skipped without env vars) Agent-Logs-Url: https://github.com/ohto-ai/webssh_cpp/sessions/87b032af-b1d4-43eb-95f2-5f7937532073 Co-authored-by: ohto-ai <46275725+ohto-ai@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add tests for login behavior using mock user creation
feat(test): add unit and integration tests for mini_buffer, SSH session, and connection manager
Apr 2, 2026
ohto-ai
marked this pull request as ready for review
April 2, 2026 15:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The project had only a placeholder test (
REQUIRE(true == true)), with no coverage of the SSH login flow, connection state, or lifecycle behavior.Build system
CMakeLists.txt: Moveenable_testing()to the top level soctestdiscovers tests from the project root.src/CMakeLists.txt: Extractssh_connection.cppinto a static librarywebssh_cpp_ssh_libwithPUBLICinclude paths, shared between the main executable and test targets.test/CMakeLists.txt: Link all test executables againstwebssh_cpp_ssh_lib(transitively pulls in libssh2 + spdlog). Rename the custom target to avoid conflict with CTest's reservedtesttarget.Bug fix
ssh_pty_connection_manager::close_channel()was declared in the header but never implemented. Added the implementation: looks up the channel by ID, erases it from the manager's weak-pointer map, then callsclose()to trigger the session cleanup chain.New tests
test/mini_buffer.test.cppreserve,resize,clear,append, move semantics, implicitchar*conversiontest/ssh_session.test.cppgenerate_id()variants,ssh_pty_connection_managerdefaults and state (max channels, unknown ID lookups)test/ssh_connection.test.cppIntegration tests skip gracefully when
TEST_SSH_HOST/TEST_SSH_USER/TEST_SSH_PASSare not set: