github.com/elves/elvish@v0.15.0/pkg/cli/modeline_test.go (about)

     1  package cli
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/elves/elvish/pkg/tt"
     7  	"github.com/elves/elvish/pkg/ui"
     8  )
     9  
    10  func TestModeLine(t *testing.T) {
    11  	testModeLine(t, tt.Fn("ModeLine", ModeLine))
    12  }
    13  
    14  func TestModePrompt(t *testing.T) {
    15  	testModeLine(t, tt.Fn("ModePrompt",
    16  		func(s string, b bool) ui.Text { return ModePrompt(s, b)() }))
    17  }
    18  
    19  func testModeLine(t *testing.T, fn *tt.FnToTest) {
    20  	tt.Test(t, fn, tt.Table{
    21  		tt.Args("TEST", false).Rets(
    22  			ui.T("TEST", ui.Bold, ui.FgWhite, ui.BgMagenta)),
    23  		tt.Args("TEST", true).Rets(
    24  			ui.Concat(
    25  				ui.T("TEST", ui.Bold, ui.FgWhite, ui.BgMagenta),
    26  				ui.T(" "))),
    27  	})
    28  }