github.com/unclejack/drone@v0.2.1-0.20140918182345-831b034aa33b/pkg/build/writer_test.go (about)

     1  package build
     2  
     3  import (
     4  	"bytes"
     5  	"testing"
     6  )
     7  
     8  func TestSetupDockerfile(t *testing.T) {
     9  	var buf bytes.Buffer
    10  
    11  	// wrap the buffer so we can analyze output
    12  	w := writer{&buf}
    13  
    14  	w.WriteString("#DRONE:676f206275696c64\n")
    15  	w.WriteString("#DRONE:676f2074657374202d76\n")
    16  	w.WriteString("PASS\n")
    17  	w.WriteString("ok  	github.com/garyburd/redigo/redis	0.113s\n")
    18  
    19  	expected := `$ go build
    20  $ go test -v
    21  PASS
    22  ok  	github.com/garyburd/redigo/redis	0.113s
    23  `
    24  	if expected != buf.String() {
    25  		t.Errorf("Expected commands decoded and echoed correctly. got \n%s", buf.String())
    26  	}
    27  }