github.com/GuanceCloud/cliutils@v1.1.21/point/set_test.go (about) 1 // Unless explicitly stated otherwise all files in this repository are licensed 2 // under the MIT License. 3 // This product includes software developed at Guance Cloud (https://www.guance.com/). 4 // Copyright 2021-present Guance, Inc. 5 6 package point 7 8 import ( 9 "testing" 10 T "testing" 11 "time" 12 13 "github.com/stretchr/testify/assert" 14 ) 15 16 func TestSet(t *testing.T) { 17 t.Run(`set-name`, func(t *T.T) { 18 p := NewPointV2(`abc`, nil) 19 p.SetName("def") 20 assert.Equal(t, `def`, p.Name()) 21 }) 22 23 t.Run(`set-time`, func(t *T.T) { 24 p := NewPointV2(`abc`, nil, WithTime(time.Unix(0, 123))) 25 p.SetTime(time.Unix(0, 456)) 26 assert.Equal(t, time.Unix(0, 456), p.Time()) 27 }) 28 }