MCPcopy Create free account

hub / github.com/ZhangShenao/harness9 / functions

Functions1,385 in github.com/ZhangShenao/harness9

FunctionTestFuzzyReplace_L4_LineByLineIndentDifference
L4: 真正测试逐行去缩进 — 每行缩进级别不同,L1/L2/L3 均无法匹配
internal/tools/edit_file_test.go:454
FunctionTestFuzzyReplace_L4_LineByLineMatch
L4: 逐行去缩进匹配
internal/tools/edit_file_test.go:181
FunctionTestFuzzyReplace_L4_MultipleMatch_Error
L4: 逐行去缩进多处匹配 → 返回错误
internal/tools/edit_file_test.go:231
FunctionTestFuzzyReplace_L4_PreservesBlockIndentation
TestFuzzyReplace_L4_PreservesBlockIndentation 验证 L4 缩进无关匹配命中后, 模型提供的 target 会被重新缩进到被替换块的缩进层级(防止 Python IndentationError)。
internal/tools/edit_file_test.go:553
FunctionTestFuzzyReplace_L4_SingleLine
L4: 单行匹配
internal/tools/edit_file_test.go:344
FunctionTestFuzzyReplace_L4_WithBlankLines
L4: 包含空行的代码块匹配
internal/tools/edit_file_test.go:316
FunctionTestFuzzyReplace_NoMatch
L4: 无匹配 → 返回错误
internal/tools/edit_file_test.go:247
FunctionTestGenerateRetry_DoesNotRetryOnContextCancel
TestGenerateRetry_DoesNotRetryOnContextCancel 验证:context 取消不触发重试。
internal/engine/agent_loop_test.go:159
FunctionTestGenerateRetry_ExhaustsThenFails
TestGenerateRetry_ExhaustsThenFails 验证:持续失败时耗尽重试后返回错误(有界)。
internal/engine/agent_loop_test.go:144
FunctionTestGenerateRetry_RecoversFromTransientError
TestGenerateRetry_RecoversFromTransientError 验证:瞬时 LLM 错误经有界重试后恢复, 整条轨迹不被一次抖动杀死。
internal/engine/agent_loop_test.go:129
FunctionTestGetModelLimits_Anthropic
(t *testing.T)
internal/provider/model_limits_test.go:33
FunctionTestGetModelLimits_AnthropicWithPrefix
(t *testing.T)
internal/provider/model_limits_test.go:40
FunctionTestGetModelLimits_EmptyString
(t *testing.T)
internal/provider/model_limits_test.go:47
FunctionTestGetModelLimits_GeminiLargeContext
(t *testing.T)
internal/provider/model_limits_test.go:54
FunctionTestGetModelLimits_KnownModel
(t *testing.T)
internal/provider/model_limits_test.go:9
FunctionTestGetModelLimits_UnknownModel
(t *testing.T)
internal/provider/model_limits_test.go:26
FunctionTestGetModelLimits_WithProviderPrefix
(t *testing.T)
internal/provider/model_limits_test.go:19
FunctionTestGlobContains_Patterns
TestGlobContains_Patterns 覆盖 matchPattern / globContains 的各类匹配路径: 尾部星号快捷路径、精确工具名、大小写不敏感、空括号。
internal/permission/rules_test.go:133
FunctionTestHTTPTransport_CloseIsNoop
TestHTTPTransport_CloseIsNoop 验证 HTTPTransport.Close 始终返回 nil。
internal/mcp/transport_test.go:35
FunctionTestHTTPTransport_Send_NetworkError
TestHTTPTransport_Send_NetworkError 验证向不可达地址发送请求时 Send 返回 HTTP 错误。 使用本地不存在的端口(9998),确保立即返回连接错误而不超时。
internal/mcp/transport_test.go:44
FunctionTestHTTPTransport_StartIsNoop
---- HTTPTransport 单元测试 ---- TestHTTPTransport_StartIsNoop 验证 HTTPTransport.Start 始终返回 nil(HTTP 是无状态的)。
internal/mcp/transport_test.go:27
FunctionTestHandleTaskPanelKeyNavigation
TestHandleTaskPanelKeyNavigation 验证任务面板的列表/详情导航: ↑↓ 光标夹紧、Enter 进详情、Esc 列表态关闭/详情态返回。
cmd/harness9/tui_test.go:1091
FunctionTestHardAssertions_IsSoftFalse
(t *testing.T)
internal/evals/assertions_test.go:155
FunctionTestHookRegistry_AllowThenAsk
TestHookRegistry_AllowThenAsk 验证白名单修复:前置 hook 显式 Allow 后,后续 hook 的 Ask 不再弹出审批。 复现场景:permHook 返回 Allow(命中白名单),dangerHook 返回 Ask(命中危险模式), 用户不应被再次要求审批。 注
internal/hooks/hook_test.go:260
FunctionTestHookRegistry_AllowWithModifiedArgs
TestHookRegistry_AllowWithModifiedArgs 验证 HookActionAllow 携带 ModifiedArgs 时参数被正确应用。 场景:路径沙箱 hook 显式放行并重写参数,内层工具应收到重写后的参数。
internal/hooks/hook_test.go:204
FunctionTestHookRegistry_AskApprovedOnce
TestHookRegistry_AskApprovedOnce 验证:同一工具调用已由人类审批后,后续相同的 Ask hook 不再弹框。 场景:两个 Ask hook 串联,第一个触发审批(通过),第二个应检测到 withApproved 标记而跳过。
internal/hooks/hook_test.go:234
FunctionTestHookRegistry_BeforeAsk_NoApprovalFn_Allows
(t *testing.T)
internal/hooks/hook_test.go:160
FunctionTestHookRegistry_BeforeAsk_WithApprovalFn_Allow
(t *testing.T)
internal/hooks/hook_test.go:187
FunctionTestHookRegistry_BeforeAsk_WithApprovalFn_Deny
(t *testing.T)
internal/hooks/hook_test.go:172
FunctionTestHookRegistry_BeforeDeny
(t *testing.T)
internal/hooks/hook_test.go:140
FunctionTestHookRegistry_BeforeShortCircuit
(t *testing.T)
internal/hooks/hook_test.go:87
FunctionTestHookRegistry_NoHooks_PassThrough
(t *testing.T)
internal/hooks/hook_test.go:74
FunctionTestHookRegistry_OnionOrder
(t *testing.T)
internal/hooks/hook_test.go:108
FunctionTestHookRegistry_Register_Delegates
(t *testing.T)
internal/hooks/hook_test.go:128
FunctionTestIndex_GetFullContent_FileMissing
(t *testing.T)
internal/skills/skills_test.go:135
FunctionTestIndex_GetFullContent_Found
(t *testing.T)
internal/skills/skills_test.go:158
FunctionTestIndex_GetFullContent_NotFound
(t *testing.T)
internal/skills/skills_test.go:147
FunctionTestIndex_IsEmpty
--- Index tests ---
internal/skills/skills_test.go:81
FunctionTestIndex_Names
(t *testing.T)
internal/skills/skills_test.go:113
FunctionTestIndex_Summary_Empty
(t *testing.T)
internal/skills/skills_test.go:92
FunctionTestIndex_Summary_WithSkills
(t *testing.T)
internal/skills/skills_test.go:99
FunctionTestIsInteractiveCmd
(t *testing.T)
cmd/harness9/tui_test.go:915
FunctionTestIsSafeURL
(t *testing.T)
internal/tools/web_safety_test.go:8
FunctionTestKeyCtrlC_WhenIdle_ReturnsQuitCmd
(t *testing.T)
cmd/harness9/tui_test.go:173
FunctionTestKeyCtrlC_WhenRunning_CallsCancelFn
(t *testing.T)
cmd/harness9/tui_test.go:187
FunctionTestKeyEnd_ReturnsToAutoScroll
(t *testing.T)
cmd/harness9/tui_test.go:272
FunctionTestKeyEnter_EmptyInput_Ignored
(t *testing.T)
cmd/harness9/tui_test.go:204
FunctionTestKeyEnter_WhenRunning_Ignored
(t *testing.T)
cmd/harness9/tui_test.go:216
FunctionTestKeyPgDown_AtBottom_StaysAutoScroll
(t *testing.T)
cmd/harness9/tui_test.go:283
FunctionTestKeyPgUp_EntersManualScroll
(t *testing.T)
cmd/harness9/tui_test.go:229
FunctionTestLoadConfig_EmptyServersField
TestLoadConfig_EmptyServersField 验证 mcpServers 为 null/缺省时 Servers 被初始化为空 map。
internal/mcp/config_test.go:85
FunctionTestLoadConfig_FileNotFound
TestLoadConfig_FileNotFound 验证文件不存在时返回空 Config(不报错)。
internal/mcp/config_test.go:10
FunctionTestLoadConfig_InvalidJSON
TestLoadConfig_InvalidJSON 验证非法 JSON 文件时返回解析错误。
internal/mcp/config_test.go:71
FunctionTestLoadConfig_ValidFile
TestLoadConfig_ValidFile 验证合法 .mcp.json 被正确解析。
internal/mcp/config_test.go:24
FunctionTestLoadDataset
(t *testing.T)
cmd/swebench/dataset_test.go:9
FunctionTestLoadDatasetFileNotFound
(t *testing.T)
cmd/swebench/dataset_test.go:32
FunctionTestLoadDataset_ParsesEnvironmentFields
TestLoadDataset_ParsesEnvironmentFields 验证新增的环境/评测字段被正确解析: version / environment_setup_commit / FAIL_TO_PASS / test_patch。 这些字段是为每实例 provision 依赖、选对 P
cmd/swebench/dataset_test.go:68
FunctionTestLoadExistingIDs
TestLoadExistingIDs 验证 --resume 跳过逻辑:仅"已产出非空 patch"的实例算完成并被跳过; 空 patch(无改动 / 瞬时失败被记空)不计入,从而在续跑时获得重试机会。
cmd/swebench/report_test.go:25
FunctionTestLoadExistingIDsEmpty
(t *testing.T)
cmd/swebench/report_test.go:13
FunctionTestLoadFromDirLoadsAgents
(t *testing.T)
internal/subagent/loader_test.go:26
FunctionTestLoadFromDirMissingIsSilent
(t *testing.T)
internal/subagent/loader_test.go:16
FunctionTestLoadFromDirNameFallbackToFilename
(t *testing.T)
internal/subagent/loader_test.go:49
FunctionTestLoadFromDirOverridesProgrammatic
(t *testing.T)
internal/subagent/loader_test.go:81
FunctionTestLoadFromDirSkipsInvalid
(t *testing.T)
internal/subagent/loader_test.go:64
FunctionTestLoadRules_InvalidJSON_ReturnsError
(t *testing.T)
internal/permission/rules_test.go:94
FunctionTestLoadRules_MissingFile_ReturnsEmpty
(t *testing.T)
internal/permission/rules_test.go:84
FunctionTestLoadRules_ValidJSON
(t *testing.T)
internal/permission/rules_test.go:58
FunctionTestLoadSkills_EmptyDir
(t *testing.T)
internal/skills/skills_test.go:203
FunctionTestLoadSkills_NonExistentDir
(t *testing.T)
internal/skills/skills_test.go:193
FunctionTestLoadSkills_SkipsInvalidFrontmatter
(t *testing.T)
internal/skills/skills_test.go:237
FunctionTestLoadSkills_SkipsSubdirWithoutSkillMd
(t *testing.T)
internal/skills/skills_test.go:257
FunctionTestLoadSkills_ValidSkills
(t *testing.T)
internal/skills/skills_test.go:214
FunctionTestLoad_DoesNotOverride
TestLoad_DoesNotOverride 验证已存在的系统环境变量不会被 .env 文件覆盖。 这确保了"系统环境变量 > .env 文件"的优先级策略。
internal/env/env_test.go:62
FunctionTestLoad_DoesNotOverrideEmptyString
TestLoad_DoesNotOverrideEmptyString 验证手动设置为空字符串的环境变量不会被 .env 文件覆盖。 这区分了"变量未定义"与"变量被显式设置为空字符串"两种情况。
internal/env/env_test.go:123
FunctionTestLoad_ExistingFile
TestLoad_ExistingFile 验证 Load 正确解析包含各种格式的 .env 文件: 普通值、双引号值、单引号值、空值
internal/env/env_test.go:15
FunctionTestLoad_FileNotFound
TestLoad_FileNotFound 验证 .env 文件不存在时的优雅降级: Load 应返回 nil(而非错误),使程序可以在没有 .env 文件时仍正常运行。
internal/env/env_test.go:53
FunctionTestLocalEnvironment_Close
(t *testing.T)
internal/sandbox/local_environment_test.go:68
FunctionTestLocalEnvironment_ID
(t *testing.T)
internal/sandbox/local_environment_test.go:10
FunctionTestLocalEnvironment_ReadWriteFile
(t *testing.T)
internal/sandbox/local_environment_test.go:39
FunctionTestLocalEnvironment_RunBash_Failure
(t *testing.T)
internal/sandbox/local_environment_test.go:28
FunctionTestLocalEnvironment_RunBash_Success
(t *testing.T)
internal/sandbox/local_environment_test.go:17
FunctionTestLocalEnvironment_WriteFile_AutoMkdir
(t *testing.T)
internal/sandbox/local_environment_test.go:56
FunctionTestLockPath_ExclusiveWriter
TestLockPath_ExclusiveWriter 验证写锁的排他性:写锁持有期间,其他写锁无法获取。 通过两个 goroutine 协同操作,验证锁的正确排他行为。
internal/tools/path_locker_test.go:34
FunctionTestLooksLikeTestRun
TestLooksLikeTestRun 验证测试运行识别启发式:真实测试调用判 true,只读/安装命令判 false。
cmd/swebench/runner_test.go:20
FunctionTestMCPPanelOverhead_LayoutConsistency
TestMCPPanelOverhead_LayoutConsistency 验证 mcpPanelOverhead 常量与实际布局吻合。 模拟 View() 拼接:panel + "\n" + statusBar,总行数应等于 contentH + mcpPanelOverhead。
cmd/harness9/tui_test.go:1290
FunctionTestMCPToolAdapter_Definition
(t *testing.T)
internal/tools/mcp_adapter_test.go:27
FunctionTestMCPToolAdapter_Execute
(t *testing.T)
internal/tools/mcp_adapter_test.go:42
FunctionTestMCPToolAdapter_Name
(t *testing.T)
internal/tools/mcp_adapter_test.go:9
FunctionTestManagerDBAccessor
(t *testing.T)
internal/memory/manager_test.go:187
FunctionTestManager_BootstrapCmd_Runs
TestManager_BootstrapCmd_Runs 验证:配置 BootstrapCmd 时,容器就绪后通过 docker exec 执行一次该命令(接入官方预装镜像 / 依赖安装的关键接缝)。
internal/sandbox/manager_test.go:14
FunctionTestManager_ConcurrentCreate
(t *testing.T)
internal/sandbox/manager_test.go:131
FunctionTestManager_CreateAndListAll
(t *testing.T)
internal/sandbox/manager_test.go:78
FunctionTestManager_CreatesDirectory
(t *testing.T)
internal/memory/manager_test.go:109
FunctionTestManager_DeleteSession
(t *testing.T)
internal/memory/manager_test.go:82
FunctionTestManager_DeleteSession_CleansOffloadDir
(t *testing.T)
internal/memory/manager_test.go:130
FunctionTestManager_DeleteSession_NoToolResultsDir_NoError
(t *testing.T)
internal/memory/manager_test.go:170
FunctionTestManager_Destroy
(t *testing.T)
internal/sandbox/manager_test.go:102
FunctionTestManager_DestroyAll
(t *testing.T)
internal/sandbox/manager_test.go:114
FunctionTestManager_InjectTools
TestManager_InjectTools 验证 InjectTools 将已连接 server 的工具注入 Registry, 返回值等于注入工具数量,且 Registry 中工具数量正确。
internal/mcp/manager_test.go:87
FunctionTestManager_InjectTools_DuplicateSkipped
TestManager_InjectTools_DuplicateSkipped 验证对同一个 Registry 二次调用 InjectTools 时,已存在的工具被跳过,第二次调用返回 0。
internal/mcp/manager_test.go:116
← previousnext →901–1,000 of 1,385, ranked by callers