github.com/kcmerrill/alfred@v0.0.0-20180727171036-06445dcb5e3d/pkg/alfred/commands_test.go (about)

     1  package alfred
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestCommandsComponent(t *testing.T) {
     8  	tasks := make(map[string]Task)
     9  	task := Task{
    10  		Dir:      "/tmp/alfred/commands",
    11  		Commands: "false\ntouch myfile.txt",
    12  	}
    13  
    14  	c := InitialContext([]string{})
    15  	c.Text.DisableFormatting = true
    16  	commands(task, c, tasks)
    17  
    18  	if c.Ok {
    19  		// it shouldn't be ok!
    20  		t.Fatalf("the false command should have failed the task!")
    21  	}
    22  }