MCPcopy Create free account

hub / github.com/ZhangShenao/harness9 / functions

Functions1,385 in github.com/ZhangShenao/harness9

FunctionTestReadFileTool_Execute_BadJSON
(t *testing.T)
internal/tools/read_file_test.go:79
FunctionTestReadFileTool_Execute_FileNotFound
(t *testing.T)
internal/tools/read_file_test.go:69
FunctionTestReadFileTool_Execute_LimitTruncation
(t *testing.T)
internal/tools/read_file_test.go:134
FunctionTestReadFileTool_Execute_OffsetBeyondEOF
(t *testing.T)
internal/tools/read_file_test.go:118
FunctionTestReadFileTool_Execute_PathTraversal
(t *testing.T)
internal/tools/read_file_test.go:87
FunctionTestReadFileTool_Execute_StartEndLine
start_line/end_line 行号模式测试
internal/tools/read_file_test.go:156
FunctionTestReadFileTool_Execute_StartEndLine_Truncation
验证 truncated 标志路径:读取中间行时有截断提示,且不消费额外行
internal/tools/read_file_test.go:239
FunctionTestReadFileTool_Execute_StartLineOnly
(t *testing.T)
internal/tools/read_file_test.go:201
FunctionTestReadFileTool_Execute_StartLineOutOfRange
(t *testing.T)
internal/tools/read_file_test.go:222
FunctionTestReadFileTool_Execute_Success
(t *testing.T)
internal/tools/read_file_test.go:32
FunctionTestReadFileTool_Execute_Truncation
(t *testing.T)
internal/tools/read_file_test.go:49
FunctionTestReadFileTool_Execute_WithOffset
(t *testing.T)
internal/tools/read_file_test.go:100
FunctionTestReadFileTool_LineNumbers
TestReadFileTool_LineNumbers 验证行号模式为每行加 `行号→Tab→内容` 前缀, 便于 LLM 精确定位、减少 edit_file 多匹配失败。
internal/tools/read_file_test.go:178
FunctionTestReadFileTool_Name
(t *testing.T)
internal/tools/read_file_test.go:11
FunctionTestReadWriteLock_MutualExclusion
TestReadWriteLock_MutualExclusion 验证读锁与写锁互斥。 读锁持有期间,写锁应被阻塞。
internal/tools/path_locker_test.go:82
FunctionTestRegistryListSorted
(t *testing.T)
internal/subagent/registry_test.go:38
FunctionTestRegistryRegisterAndGet
(t *testing.T)
internal/subagent/registry_test.go:9
FunctionTestRegistryRejectsDuplicate
(t *testing.T)
internal/subagent/registry_test.go:23
FunctionTestRegistryRejectsInvalid
(t *testing.T)
internal/subagent/registry_test.go:31
FunctionTestRegistry_Execute_RecoversPanic
TestRegistry_Execute_RecoversPanic 验证工具内部 panic 被转换为 IsError 结果, 而非让整个进程崩溃(并发执行时尤为关键)。
internal/tools/registry_test.go:43
FunctionTestRegistry_Execute_Success
(t *testing.T)
internal/tools/registry_test.go:118
FunctionTestRegistry_Execute_ToolExecutionError
(t *testing.T)
internal/tools/registry_test.go:157
FunctionTestRegistry_Execute_ToolNotFound
(t *testing.T)
internal/tools/registry_test.go:139
FunctionTestRegistry_GetAvailableTools_MultipleTools
(t *testing.T)
internal/tools/registry_test.go:106
FunctionTestRegistry_Register_AddsDefinition
(t *testing.T)
internal/tools/registry_test.go:67
FunctionTestRegistry_Register_DuplicateReturnsError
TestRegistry_Register_DuplicateReturnsError 验证同名工具重复注册时: 1. 第二次 Register 返回 error 2. 原工具保持不变,未被新实现覆盖
internal/tools/registry_test.go:84
FunctionTestRenderFooter_ShowsShellHintsInShellMode
(t *testing.T)
cmd/harness9/tui_test.go:1039
FunctionTestRenderInput_ShowsShellBadgeInShellMode
(t *testing.T)
cmd/harness9/tui_test.go:1016
FunctionTestRenderMCPPanel_EmptyServers
TestRenderMCPPanel_EmptyServers 验证无 MCP Server 时显示未配置提示。
cmd/harness9/tui_test.go:1181
FunctionTestRenderMCPPanel_RowCount
TestRenderMCPPanel_RowCount 验证面板产生恰好 contentH+3 行, 使 View() 追加 "\n" + renderStatusBar 后总高度 = contentH+4 = m.height。
cmd/harness9/tui_test.go:1193
FunctionTestRenderMCPPanel_ScrollHint
TestRenderMCPPanel_ScrollHint 验证滚动提示仅在内容超出高度时出现。
cmd/harness9/tui_test.go:1227
FunctionTestRenderMCPPanel_ScrollOffset
TestRenderMCPPanel_ScrollOffset 验证 mcpPanelScroll 正确跳过头部行。
cmd/harness9/tui_test.go:1260
FunctionTestRenderThinkingLines_WrapsAtWidth
(t *testing.T)
cmd/harness9/tui_test.go:539
FunctionTestResolvePrompt_NilIndex
TestResolvePrompt_NilIndex 验证 idx 为 nil 时斜杠命令作为普通输入透传。
cmd/harness9/cli_test.go:74
FunctionTestResolvePrompt_PlainInput
TestResolvePrompt_PlainInput 验证普通输入原样透传。
cmd/harness9/cli_test.go:63
FunctionTestResolvePrompt_SkillOnly
TestResolvePrompt_SkillOnly 验证 /skill-name 返回 skill body。
cmd/harness9/cli_test.go:85
FunctionTestResolvePrompt_SkillWithExtra
TestResolvePrompt_SkillWithExtra 验证 /skill-name extra text 正确拼接。
cmd/harness9/cli_test.go:97
FunctionTestResolvePrompt_UnknownSkill
TestResolvePrompt_UnknownSkill 验证不存在的技能返回 ok=false。
cmd/harness9/cli_test.go:110
FunctionTestResolveTools
(t *testing.T)
internal/subagent/definition_test.go:31
FunctionTestRules_Evaluate_Allow
(t *testing.T)
internal/permission/rules_test.go:11
FunctionTestRules_Evaluate_Ask
(t *testing.T)
internal/permission/rules_test.go:32
FunctionTestRules_Evaluate_Deny
(t *testing.T)
internal/permission/rules_test.go:23
FunctionTestRules_Evaluate_NoMatch_ReturnsAsk
(t *testing.T)
internal/permission/rules_test.go:41
FunctionTestRules_FirstMatchWins
(t *testing.T)
internal/permission/rules_test.go:48
FunctionTestRunCLI_ContextCancel
TestRunCLI_ContextCancel 验证 ctx 取消时 runCLI 正常返回。
cmd/harness9/cli_test.go:43
FunctionTestRunCLI_EOFExits
TestRunCLI_EOFExits 验证 stdin 关闭(EOF)时 runCLI 正常返回。
cmd/harness9/cli_test.go:36
FunctionTestRunCLI_ExitCommand
TestRunCLI_ExitCommand 验证输入 "exit" 时 runCLI 正常返回,不阻塞。
cmd/harness9/cli_test.go:22
FunctionTestRunCLI_QuitCommand
TestRunCLI_QuitCommand 验证输入 "quit" 时 runCLI 正常返回。
cmd/harness9/cli_test.go:29
FunctionTestRunCLI_UnknownSkill
TestRunCLI_UnknownSkill 验证 /nonexistent 输入时 runCLI 正常返回,不 panic。
cmd/harness9/cli_test.go:52
FunctionTestRunCase_NoTool
(t *testing.T)
internal/evals/harness_test.go:39
FunctionTestRunCase_SimpleBash
(t *testing.T)
internal/evals/harness_test.go:11
FunctionTestRunLoopLoadsHistory
(t *testing.T)
internal/engine/memory_test.go:45
FunctionTestRunLoopPersistsMessages
(t *testing.T)
internal/engine/memory_test.go:14
FunctionTestRunLoopWithCompactor
(t *testing.T)
internal/engine/memory_test.go:78
FunctionTestRunLoop_PlanMode_FiltersWriteTools
TestRunLoop_PlanMode_FiltersWriteTools 验证 Plan Mode 下写操作工具被过滤,只读工具保留。
internal/engine/agent_loop_test.go:714
FunctionTestRunLoop_PlanMode_InjectsPlanPrefix
TestRunLoop_PlanMode_InjectsPlanPrefix 验证 Plan Mode 下用户 prompt 被注入了规划前缀。
internal/engine/agent_loop_test.go:454
FunctionTestRunLoop_WithTodoStore_RestoresAndSaves
TestRunLoop_WithTodoStore_RestoresAndSaves 验证 WithTodoStore 的跨会话持久化行为: 1. runLoop 启动时从 Session 恢复 TodoStore 状态(Session 是持久化的 source of truth) 2. runLo
internal/engine/agent_loop_test.go:413
FunctionTestRunStreamInjectsSubAgentProgress
(t *testing.T)
internal/engine/stream_test.go:385
FunctionTestRunStream_ContextCancellation_ReceivesEventError
(t *testing.T)
internal/engine/stream_test.go:104
FunctionTestRunStream_EmitsAllEventTypes
TestRunStream_EmitsAllEventTypes 验证携带工具调用的完整流程中各事件类型均被发出。
internal/engine/stream_test.go:53
FunctionTestRunStream_EventTurnNumbering
(t *testing.T)
internal/engine/stream_test.go:221
FunctionTestRunStream_MaxTurns_ReceivesEventError
(t *testing.T)
internal/engine/stream_test.go:139
FunctionTestRunStream_NormalCompletion_ReceivesEventDone
(t *testing.T)
internal/engine/stream_test.go:26
FunctionTestRunStream_ThinkingDelta_DataIsString
(t *testing.T)
internal/engine/stream_test.go:327
FunctionTestRunStream_ThinkingDelta_EmitsEventThinkingDelta
(t *testing.T)
internal/engine/stream_test.go:304
FunctionTestRunStream_ThinkingDelta_PrecedesActionDelta
TestRunStream_ThinkingDelta_PrecedesActionDelta 验证 EventThinkingDelta 总在 EventActionDelta 之前到达(流中推理先于正文产生)。
internal/engine/stream_test.go:354
FunctionTestRunStream_ToolResultDataIsToolResult
(t *testing.T)
internal/engine/stream_test.go:244
FunctionTestRunStream_ToolStartBeforeToolResult
(t *testing.T)
internal/engine/stream_test.go:174
FunctionTestRunnerBackgroundFailClosed
TestRunnerBackgroundFailClosed 验证:后台模式下,子代理的工具审批永不 升级到人类(fail-closed),父级 ApprovalFunc 绝不会被调用。
internal/subagent/runner_test.go:229
FunctionTestRunnerBackgroundUsesCtxSink
语义变更:runner 不再对后台特判进度——前台/后台都使用 ctx 中的 progress sink。 后台的"安全性"(不向父 channel 发送)由调用方(TaskTool)注入干净 sink 保证,在 task_tool_test 验证。 此处验证:background=true 且 c
internal/subagent/runner_test.go:259
FunctionTestRunnerContextIsolation
(t *testing.T)
internal/subagent/runner_test.go:102
FunctionTestRunnerErrorPropagation
TestRunnerErrorPropagation 验证:当子代理始终发起工具调用、永不终止时, 引擎触及 max-turns 上限返回错误,Run 返回非 nil error 且发出 SubAgentError 进度。
internal/subagent/runner_test.go:288
FunctionTestRunnerForegroundApprovalBridge
TestRunnerForegroundApprovalBridge 验证:前台模式下,子代理触发的工具审批 会桥接到父级 ApprovalFunc(人类在环),而非自动拒绝。
internal/subagent/runner_test.go:195
FunctionTestRunnerForegroundOutlivesParentToolTimeout
TestRunnerForegroundOutlivesParentToolTimeout 回归测试:前台子代理不应被父引擎的 "工具执行超时"(默认 60s)杀死——子代理本身是多轮 agent,整轮可能远超单个工具的时限。 修复前:前台 execCtx 直接复用调用方 ctx(带 toolTim
internal/subagent/runner_test.go:23
FunctionTestRunnerForwardsProgress
(t *testing.T)
internal/subagent/runner_test.go:140
FunctionTestRunnerReturnsFinalText
(t *testing.T)
internal/subagent/runner_test.go:125
FunctionTestRunnerToolIsolation
(t *testing.T)
internal/subagent/runner_test.go:76
FunctionTestSQLiteSession_AddAndGetAll
(t *testing.T)
internal/memory/sqlite_session_test.go:28
FunctionTestSQLiteSession_Clear
(t *testing.T)
internal/memory/sqlite_session_test.go:135
FunctionTestSQLiteSession_GetTodos_CrossSessionIsolation
(t *testing.T)
internal/memory/sqlite_session_test.go:261
FunctionTestSQLiteSession_GetWithLimit
(t *testing.T)
internal/memory/sqlite_session_test.go:55
FunctionTestSQLiteSession_Persistence
(t *testing.T)
internal/memory/sqlite_session_test.go:148
FunctionTestSQLiteSession_PopMessage
(t *testing.T)
internal/memory/sqlite_session_test.go:112
FunctionTestSQLiteSession_SaveAndGetTodos
(t *testing.T)
internal/memory/sqlite_session_test.go:177
FunctionTestSQLiteSession_SaveTodos_Empty
(t *testing.T)
internal/memory/sqlite_session_test.go:236
FunctionTestSQLiteSession_SaveTodos_WriteReplace
(t *testing.T)
internal/memory/sqlite_session_test.go:209
FunctionTestSQLiteSession_ToolCalls
(t *testing.T)
internal/memory/sqlite_session_test.go:77
FunctionTestSafePath_AbsolutePathInsideWorkDir
TestSafePath_AbsolutePathInsideWorkDir 验证:当输入已是 workDir 下的绝对路径时, safePath 直接返回该绝对路径,而不会与 workDir 拼接成翻倍路径(回归测试)。 这是 SWE-bench 轨迹中 10/12 实例命中的 read_file
internal/tools/safe_path_test.go:52
FunctionTestSafePath_AbsolutePathOutsideWorkDir
TestSafePath_AbsolutePathOutsideWorkDir 验证绝对路径逃逸 workDir 时仍被拒绝。
internal/tools/safe_path_test.go:75
FunctionTestSafePath_AllowsInsideWorkDir
TestSafePath_AllowsInsideWorkDir 验证 safePath 接受合法路径。
internal/tools/safe_path_test.go:29
FunctionTestSafePath_BlocksTraversal
TestSafePath_BlocksTraversal 验证 safePath 拒绝路径遍历攻击。
internal/tools/safe_path_test.go:13
FunctionTestSafePath_SensitivePathBlocked
(t *testing.T)
internal/tools/safe_path_test.go:89
FunctionTestSampleByRepo
(t *testing.T)
cmd/swebench/dataset_test.go:39
FunctionTestSanitizeMCPName
(t *testing.T)
internal/tools/mcp_adapter_test.go:67
FunctionTestSaveRules_RoundTrip
(t *testing.T)
internal/permission/rules_test.go:106
FunctionTestScriptedProvider_ErrorTurn
(t *testing.T)
internal/evals/provider_test.go:54
FunctionTestScriptedProvider_RecordsCalls
(t *testing.T)
internal/evals/provider_test.go:34
FunctionTestScriptedProvider_Reset
(t *testing.T)
internal/evals/provider_test.go:75
FunctionTestScriptedProvider_ReturnsScriptedTurns
(t *testing.T)
internal/evals/provider_test.go:12
FunctionTestScriptedProvider_ToolCalls
(t *testing.T)
internal/evals/provider_test.go:42
← previousnext →1,101–1,200 of 1,385, ranked by callers