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

     1  package cli_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/elves/elvish/pkg/cli"
     7  )
     8  
     9  func TestCodeBufferUtils(t *testing.T) {
    10  	app := NewApp(AppSpec{})
    11  	buf := CodeBuffer{Content: "test code", Dot: 2}
    12  	SetCodeBuffer(app, buf)
    13  	if gotBuf := GetCodeBuffer(app); gotBuf != buf {
    14  		t.Errorf("Got buffer %v, want %v", gotBuf, buf)
    15  	}
    16  }
    17  
    18  func TestAddonUtils(t *testing.T) {
    19  	app := NewApp(AppSpec{})
    20  	addon := Empty{}
    21  	SetAddon(app, addon)
    22  	if gotAddon := Addon(app); gotAddon != addon {
    23  		t.Errorf("Got addon %v, want %v", gotAddon, addon)
    24  	}
    25  }