mirror of
https://github.com/divan/expvarmon.git
synced 2025-04-25 13:48:54 +08:00
20 lines
354 B
Go
20 lines
354 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestVarName(t *testing.T) {
|
|
v := VarName("memstats.Alloc")
|
|
|
|
slice := v.ToSlice()
|
|
if len(slice) != 2 || slice[0] != "memstats" || slice[1] != "Alloc" {
|
|
t.Fatalf("ToSlice failed: %v", slice)
|
|
}
|
|
|
|
short := v.Short()
|
|
if short != "Alloc" {
|
|
t.Fatalf("Expecting Short() to be 'Alloc', but got: %s", short)
|
|
}
|
|
}
|