mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-07-09 17:28:58 +00:00
Add comprehensive unit tests covering config dispatch, emit run result, git helpers, provider commands, provider TUI pure functions and View rendering, shared utilities, flags parsing, scan command flags, and small file entry points (version, viewer, llm, rules commands).
30 lines
685 B
Go
30 lines
685 B
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestRunConfig_UnknownSubcommand(t *testing.T) {
|
|
err := runConfig([]string{"delete", "foo"})
|
|
if err == nil {
|
|
t.Fatal("expected error for unknown subcommand")
|
|
}
|
|
if !strings.Contains(err.Error(), "unknown") {
|
|
t.Errorf("error = %q, expected to contain 'unknown'", err.Error())
|
|
}
|
|
}
|
|
|
|
func TestRunConfig_InvalidSetMissingValue(t *testing.T) {
|
|
err := runConfig([]string{"set", "provider"})
|
|
if err == nil {
|
|
t.Fatal("expected error for set without value")
|
|
}
|
|
}
|
|
|
|
func TestRunConfig_InvalidUnsetMissingKey(t *testing.T) {
|
|
err := runConfig([]string{"unset"})
|
|
if err == nil {
|
|
t.Fatal("expected error for unset without key")
|
|
}
|
|
}
|