github.com/markusbkk/elvish@v0.0.0-20231204143114-91dc52438621/pkg/ui/text_segment_test.go (about) 1 package ui 2 3 import ( 4 "testing" 5 6 "github.com/markusbkk/elvish/pkg/eval/vals" 7 ) 8 9 func TestTextSegmentAsElvishValue(t *testing.T) { 10 vals.TestValue(t, &Segment{Style{}, "foo"}). 11 Kind("ui:text-segment"). 12 Repr("foo"). 13 AllKeys("text", "fg-color", "bg-color", 14 "bold", "dim", "italic", "underlined", "blink", "inverse"). 15 Index("text", "foo"). 16 Index("fg-color", "default"). 17 Index("bg-color", "default"). 18 Index("bold", false). 19 Index("dim", false). 20 Index("italic", false). 21 Index("underlined", false). 22 Index("blink", false). 23 Index("inverse", false) 24 25 vals.TestValue(t, &Segment{Style{Foreground: Red, Background: Blue}, "foo"}). 26 Repr("(ui:text-segment foo &fg-color=red &bg-color=blue)"). 27 Index("fg-color", "red"). 28 Index("bg-color", "blue") 29 }