@@ -10,6 +10,50 @@ import (
10
10
"github.com/google/go-cmp/cmp"
11
11
)
12
12
13
+ func ExampleTruncateLabel () {
14
+ length1 := TruncateLabel (1 , "NW-TEST-FIRST" , "Name of my monitor" )
15
+ fmt .Println (length1 )
16
+
17
+ length3 := TruncateLabel (3 , "NW-TEST-FIRST" , "Name of my monitor" )
18
+ fmt .Println (length3 )
19
+
20
+ length5 := TruncateLabel (5 , "NW-TEST-FIRST" , "Name of my monitor" )
21
+ fmt .Println (length5 )
22
+
23
+ length7 := TruncateLabel (7 , "NW-TEST-FIRST" , "Name of my monitor" )
24
+ fmt .Println (length7 )
25
+
26
+ length10 := TruncateLabel (10 , "NW-TEST-FIRST" , "Name of my monitor" )
27
+ fmt .Println (length10 )
28
+
29
+ length20 := TruncateLabel (20 , "NW-TEST-FIRST" , "Name of my monitor" )
30
+ fmt .Println (length20 )
31
+
32
+ length32 := TruncateLabel (32 , "NW-TEST-FIRST" , "Name of my monitor" )
33
+ fmt .Println (length32 )
34
+
35
+ length64 := TruncateLabel (64 , "NW-TEST-FIRST" , "Name of my monitor" )
36
+ fmt .Println (length64 )
37
+
38
+ length128 := TruncateLabel (128 , "NW-TEST-FIRST" , "Name of my monitor" )
39
+ fmt .Println (length128 )
40
+
41
+ length256 := TruncateLabel (256 , "NW-TEST-FIRST" , "Name of my monitor" )
42
+ fmt .Println (length256 )
43
+
44
+ // Output:
45
+ // …
46
+ // …
47
+ // …: …
48
+ // …: Nam…
49
+ // N…: Name…
50
+ // NW-TES…: Name of my…
51
+ // NW-TEST-FIRS…: Name of my monit…
52
+ // NW-TEST-FIRST: Name of my monitor
53
+ // NW-TEST-FIRST: Name of my monitor
54
+ // NW-TEST-FIRST: Name of my monitor
55
+ }
56
+
13
57
func TestTruncateLabel (t * testing.T ) {
14
58
for name , tc := range testfixtures .TruncateLabelTestTable {
15
59
t .Run (name , func (t * testing.T ) {
0 commit comments