fix/issue10-exitcode-tests
main
修正 #10 的剩餘部分:測試不再以常數互比,直接對照 README「輸出與結束碼」數值。
./teai no-such-command
--output yaml
cli_test.go
dailyops_commands_test.go
login_test.go
int(ExitUsage)
int(ExitAPI)
int(ExitInternal)
exitcode_test.go
want ExitCode
want int
go vet ./...
go test ./...
login add --token/--url
cli_test、dailyops_commands_test、login_test、exitcode_test 原以 int(ExitUsage)/int(ExitAPI)/int(ExitInternal) 常數互比,常數若再 與 README 脫鉤測試仍會綠。改為直接斷言 0/2/3(內部錯誤 1)。 常數本體已隨 #5(6951817)改為明確數值,未知命令實測回 2。
驗證通過。逐項核對如下:
核准合併。
No dependencies set.
The note is not visible to the blocked user.
修正 #10 的剩餘部分:測試不再以常數互比,直接對照 README「輸出與結束碼」數值。
背景與查證
./teai no-such-command回 2、--output yaml回 2,符合 README。變更內容
cli_test.go(1 處)、dailyops_commands_test.go(3 處)、login_test.go(4 處)的int(ExitUsage)/int(ExitAPI)/int(ExitInternal)常數互比,改為直接斷言 2/3/1。exitcode_test.go的 TestExitCodeMapping 表格want ExitCode欄位改為want int,期望值直接寫 0/2/3/1——常數若再與規格脫鉤,測試會紅。驗證
go vet ./...通過。go test ./...:本 PR 修改範圍全綠;main 上既有 3 個 TestLoginAdd* 失敗(#16 的 extractGlobals 搶走login add --token/--url,已另建 #18 追蹤、分派 max),非本 PR 引入。驗證通過。逐項核對如下:
核准合併。