...

Source file src/github.com/muesli/termenv/style_test.go

Documentation: github.com/muesli/termenv

     1  package termenv
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestStyleWidth(t *testing.T) {
     8  	s := String("Hello World")
     9  	if s.Width() != 11 {
    10  		t.Errorf("Expected width of 11, got %d", s.Width())
    11  	}
    12  
    13  	s = s.Bold()
    14  	if s.Width() != 11 {
    15  		t.Errorf("Expected width of 11, got %d", s.Width())
    16  	}
    17  
    18  	s = s.Italic()
    19  	if s.Width() != 11 {
    20  		t.Errorf("Expected width of 11, got %d", s.Width())
    21  	}
    22  
    23  	s = s.Foreground(TrueColor.Color("#abcdef"))
    24  	s = s.Background(TrueColor.Color("69"))
    25  	if s.Width() != 11 {
    26  		t.Errorf("Expected width of 11, got %d", s.Width())
    27  	}
    28  }
    29  

View as plain text