mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-20 23:57:11 -04:00
[PR #172] [MERGED] test: add unit tests for executor helpers and terminal utilities #214
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/172
Author: @mason5052
Created: 3/2/2026
Status: ✅ Merged
Merged: 3/2/2026
Merged by: @asdek
Base:
feature/next_release← Head:test/executor-terminal-unit-tests📝 Commits (1)
df401c9test: add unit tests for executor helpers and terminal utilities📊 Changes
2 files changed (+295 additions, -0 deletions)
View changed files
➕
backend/pkg/tools/executor_test.go(+193 -0)➕
backend/pkg/tools/terminal_test.go(+102 -0)📄 Description
Description
Add unit tests for helper functions in two core modules:
backend/pkg/tools/executor.go- JSON argument processing and barrier function managementbackend/pkg/tools/terminal.go- Terminal name generation and ANSI-formatted outputType of Change
Areas Affected
backend/pkg/tools/executor_test.go(new file)backend/pkg/tools/terminal_test.go(new file)Testing
All tests are self-contained, table-driven, and use
t.Parallel().executor_test.go (4 test functions):
TestGetMessage- extracts "message" field from JSON args; covers valid message, empty message, missing field, invalid JSON, empty object, unicode contentTestArgsToMarkdown- converts JSON args to markdown bullet list; verifies "message" key is skipped, handles single/multiple fields, invalid JSON errors, empty objectsTestIsBarrierFunction- checks barrier map membership for known barriers (done, ask_user) and non-barriersTestGetBarrierToolNames- returns all registered barrier tool names, verifies count and contentsterminal_test.go (3 test functions):
TestPrimaryTerminalName- generates "pentagi-terminal-{flowID}" format for various flow IDsTestFormatTerminalInput- ANSI yellow-colored terminal input with cwd prefix, verifies color codes and line endingsTestFormatTerminalSystemOutput- ANSI blue-colored system output, verifies color codes and content wrappingSecurity Considerations
No security impact - test-only changes.
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.