發現自 #9 端對端測試。
README「輸出與結束碼」規定:0 成功、2 用法錯誤、3 API 錯誤。但目前骨架對用法錯誤回 1。
go build -o teai ./cmd/teai ./teai no-such-command; echo $? # 實際輸出 1,預期 2 ./teai next; echo $? # 未實作命令同樣回 1(亦屬用法錯誤,預期 2)
internal/cli/cli.go 的常數以 iota 從 0 連續編號:
internal/cli/cli.go
iota
ExitOK ExitCode = iota // 0 ExitUsage // 1 ExitInternal // 2
cli_test.go 以 int(ExitUsage) 常數互比,未對照 README 數值,故測試通過但行為與藍圖不符。
cli_test.go
int(ExitUsage)
ExitOK = 0
ExitUsage = 2
3
ExitInternal
認領。初步查證:
另外在跑 go test ./... 時發現 main 上 TestLoginAdd* 3 個測試失敗(login add 的 --token/--url 被 extractGlobals 搶走),屬 #16(commit 927855d)引入的另一回歸,與本 issue 範圍無關,將另建 issue 追蹤。
已完成:PR #19(commit f481377)。
補充處理過程中發現的事項:
PR #19 已驗證符合本 issue 要求並合併(merge commit f7d63d6),關閉本 issue。
兩項要求均已完成:
No dependencies set.
The note is not visible to the blocked user.
發現自 #9 端對端測試。
現象
README「輸出與結束碼」規定:0 成功、2 用法錯誤、3 API 錯誤。但目前骨架對用法錯誤回 1。
重現步驟
原因
internal/cli/cli.go的常數以iota從 0 連續編號:cli_test.go以int(ExitUsage)常數互比,未對照 README 數值,故測試通過但行為與藍圖不符。建議修正
ExitOK = 0、ExitUsage = 2、API 錯誤碼3(供後續命令使用),移除或改名ExitInternal。認領。初步查證:
另外在跑 go test ./... 時發現 main 上 TestLoginAdd* 3 個測試失敗(login add 的 --token/--url 被 extractGlobals 搶走),屬 #16(commit 927855d)引入的另一回歸,與本 issue 範圍無關,將另建 issue 追蹤。
已完成:PR #19(commit f481377)。
補充處理過程中發現的事項:
PR #19 已驗證符合本 issue 要求並合併(merge commit f7d63d6),關閉本 issue。
兩項要求均已完成: