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/must/must_test.go

26 lines
458 B
Go

// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package must
import "testing"
func TestGet(t *testing.T) {
val := Get(42, nil)
if val != 42 {
t.Errorf("Get(42, nil) = %d, want 42", val)
}
}
func TestGetPanic(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Error("Get with error did not panic")
}
}()
Get(0, error(nil))
Get(0, (*error)(nil))
type testError struct{}
Get(0, testError{})
}