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

     1  package alfred
     2  
     3  import "testing"
     4  
     5  func TestEmptyCLI(t *testing.T) {
     6  	task, args := CLI([]string{})
     7  	if task != "" {
     8  		t.Fatalf("Expected: an empty task")
     9  	}
    10  
    11  	if len(args) >= 1 {
    12  		t.Fatalf("No args were passed in. Should be len(0)")
    13  	}
    14  }
    15  
    16  func TestCLI(t *testing.T) {
    17  	task, args := CLI([]string{"/tester:one", "two"})
    18  	if task != "/tester:one" {
    19  		t.Fatalf("Expected /tester:one")
    20  	}
    21  
    22  	if args[0] != "two" {
    23  		t.Fatalf("Expected an argument to be passed in.")
    24  	}
    25  }