github.com/grange74/docker@v1.6.0-rc3/pkg/system/lstat_test.go (about)

     1  package system
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  )
     7  
     8  func TestLstat(t *testing.T) {
     9  	file, invalid, _, dir := prepareFiles(t)
    10  	defer os.RemoveAll(dir)
    11  
    12  	statFile, err := Lstat(file)
    13  	if err != nil {
    14  		t.Fatal(err)
    15  	}
    16  	if statFile == nil {
    17  		t.Fatal("returned empty stat for existing file")
    18  	}
    19  
    20  	statInvalid, err := Lstat(invalid)
    21  	if err == nil {
    22  		t.Fatal("did not return error for non-existing file")
    23  	}
    24  	if statInvalid != nil {
    25  		t.Fatal("returned non-nil stat for non-existing file")
    26  	}
    27  }