Skip to content

Latest commit

 

History

History

tests

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

tests/

Unit tests for acecode, built with GoogleTest.

Run

cmake -B build -DBUILD_TESTING=ON ...    # (usual toolchain args)
cmake --build build --target acecode_unit_tests
ctest --test-dir build --output-on-failure

Layout

Tests mirror module paths and omit the source group prefix (D15):

Production source Test location
base/platform tests/platform
domain/session tests/session
adapters/tool tests/tool
engine/agent tests/agent
host/session_host tests/session_host
apps/tui tests/tui

Keep the same subdirectories for a nested module. Shared fixtures live under tests/test_support; AgentLoop fixtures inject dependencies before start, and characterization fixtures isolate HOME, provider scripts and session data.

Adding a new test file needs no CMake edit — tests/CMakeLists.txt globs *_test.cpp (note: singular _test, not _tests).

What's in scope

  • Pure logic: serializers, validators, parsers, glob matchers, hash functions.
  • Headless state machines: tool progress line buffering, line/chunk processors.
  • Schema roundtrips: SessionMeta, ChatMessage, config files.

What's exempt

  • The TUI entry point src/apps/cli/main.cpp and the full terminal loop are validated manually. All TUI implementations compile once in acecode_tui; tests link those production archives through the source-free acecode_testable interface. No testable TUI allowlist is required. Executable entry points and WebView shells remain outside the test aggregate.
  • LLM provider HTTP paths (CopilotProvider, OpenAiCompatProvider) — need mock HTTP server; left to a future integration-tests change.
  • Real provider/network end-to-end behavior needs configured services. AgentLoop protocol, ownership and lifecycle regressions use injected providers and local HTTP fixtures in the unit suite.

Conventions

  • Test suite name (first arg to TEST) matches the unit under test (SanitizeTitle, SessionStorage, Base64Encode).
  • Prefer EXPECT_* over ASSERT_* except when later assertions would crash on the failing state (e.g. ASSERT_EQ(vec.size(), 1u) before vec[0]).
  • Use testing::TempDir() or std::filesystem::temp_directory_path() for any file I/O — never write to the repo tree.
  • Shared helpers (StubLlmProvider, the sandbox / channels test_support, theme resources, computer-use smoke helpers) live under tests/test_support/<area>/ and are included with the full prefix, e.g. #include "test_support/agent/stub_provider.hpp". Project headers use the module-root form ("session/session_storage.hpp"), never ../.