You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/util/cmpx/cmpx_test.go

25 lines
557 B
Go

// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package cmpx
import "testing"
func TestOr(t *testing.T) {
if g, w := Or[string](), ""; g != w {
t.Errorf("got %v; want %v", g, w)
}
if g, w := Or[int](), 0; g != w {
t.Errorf("got %v; want %v", g, w)
}
if g, w := Or("", "foo", "bar"), "foo"; g != w {
t.Errorf("got %v; want %v", g, w)
}
if g, w := Or("foo", "bar"), "foo"; g != w {
t.Errorf("got %v; want %v", g, w)
}
if g, w := Or("", "", "bar"), "bar"; g != w {
t.Errorf("got %v; want %v", g, w)
}
}