mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-27 03:55:36 +00:00
25 lines
557 B
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)
|
||
|
}
|
||
|
}
|