github.com/pkumar631/talisman@v0.3.2/talisman_internal_test.go (about)

     1  package main
     2  
     3  import (
     4  	"io/ioutil"
     5  	"os"
     6  	"testing"
     7  
     8  	"github.com/stretchr/testify/assert"
     9  )
    10  
    11  func TestParsingShasFromStdIn(t *testing.T) {
    12  	file, err := ioutil.TempFile(os.TempDir(), "mockStdin")
    13  	if err != nil {
    14  		panic(err)
    15  	}
    16  	defer os.Remove(file.Name())
    17  	defer file.Close()
    18  	file.WriteString("localRef localSha remoteRef remoteSha")
    19  	file.Seek(0, 0)
    20  
    21  	_, oldSha, _, newSha := readRefAndSha(file)
    22  	assert.Equal(t, "localSha", oldSha, "oldSha did not equal 'localSha', got: %s", oldSha)
    23  	assert.Equal(t, "remoteSha", newSha, "newSha did not equal 'remoteSha', got: %s", newSha)
    24  }