Files
larksuite-cli/internal/output/errors_test.go
梁硕 83dfb068ad feat: open-source lark-cli — the official CLI for Lark/Feishu
Change-Id: I113d9cdb5403cec347efe4595415e34a18b7decf
2026-03-28 10:36:25 +08:00

40 lines
827 B
Go

// Copyright (c) 2026 Lark Technologies Pte. Ltd.
// SPDX-License-Identifier: MIT
package output
import (
"fmt"
"testing"
)
func TestMarkRaw_ExitError(t *testing.T) {
err := ErrAPI(99991672, "API error: [99991672] scope not enabled", nil)
if err.Raw {
t.Fatal("expected Raw=false before MarkRaw")
}
result := MarkRaw(err)
if result != err {
t.Error("expected MarkRaw to return the same error")
}
if !err.Raw {
t.Error("expected Raw=true after MarkRaw")
}
}
func TestMarkRaw_NonExitError(t *testing.T) {
plain := fmt.Errorf("some plain error")
result := MarkRaw(plain)
if result != plain {
t.Error("expected MarkRaw to return the same error for non-ExitError")
}
}
func TestMarkRaw_Nil(t *testing.T) {
result := MarkRaw(nil)
if result != nil {
t.Error("expected MarkRaw(nil) to return nil")
}
}