summaryrefslogtreecommitdiffhomepage
path: root/control/controlknobs/controlknobs_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'control/controlknobs/controlknobs_test.go')
-rw-r--r--control/controlknobs/controlknobs_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/control/controlknobs/controlknobs_test.go b/control/controlknobs/controlknobs_test.go
new file mode 100644
index 000000000..266a4708d
--- /dev/null
+++ b/control/controlknobs/controlknobs_test.go
@@ -0,0 +1,21 @@
+// Copyright (c) Tailscale Inc & AUTHORS
+// SPDX-License-Identifier: BSD-3-Clause
+
+package controlknobs
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestAsDebugJSON(t *testing.T) {
+ var nilPtr *Knobs
+ if got := nilPtr.AsDebugJSON(); got != nil {
+ t.Errorf("AsDebugJSON(nil) = %v; want nil", got)
+ }
+ k := new(Knobs)
+ got := k.AsDebugJSON()
+ if want := reflect.TypeOf(Knobs{}).NumField(); len(got) != want {
+ t.Errorf("AsDebugJSON map has %d fields; want %v", len(got), want)
+ }
+}