weather/flags_test.go

37 lines
878 B
Go

package main
import "testing"
func TestParseArgsSearchWayland(t *testing.T) {
opts, err := parseArgs([]string{"--wayland", "--search"})
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if !opts.searchSet || !opts.wayland {
t.Fatalf("expected search+wayland set")
}
if opts.searchValue != "" {
t.Fatalf("expected empty search value")
}
}
func TestParseArgsSearchRequiresValueWithoutWayland(t *testing.T) {
opts, err := parseArgs([]string{"--search"})
if err != nil {
t.Fatalf("parse error: %v", err)
}
if !opts.searchSet || opts.searchValue != "" {
t.Fatalf("expected search set with empty value")
}
}
func TestParseArgsUnits(t *testing.T) {
opts, err := parseArgs([]string{"--units", "C"})
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if opts.temperatureU != "C" {
t.Fatalf("expected units C, got %s", opts.temperatureU)
}
}