...

Source file src/github.com/AdamKorcz/go-118-fuzz-build/testing/t_test.go

Documentation: github.com/AdamKorcz/go-118-fuzz-build/testing

     1  package testing
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  )
     7  
     8  func TestTempDirs(t *testing.T) {
     9  	fuzzT := NewT()
    10  	tDir1 := fuzzT.TempDir()
    11  
    12  	fi, err := os.Stat(tDir1)
    13  	if err != nil {
    14  		panic(err)
    15  	}
    16  	if !fi.IsDir() {
    17  		t.Fatal("This should be a directory")
    18  	}
    19  
    20  	tDir2 := fuzzT.TempDir()
    21  	fi, err = os.Stat(tDir2)
    22  	if err != nil {
    23  		panic(err)
    24  	}
    25  	if !fi.IsDir() {
    26  		t.Fatal("This should be a directory")
    27  	}
    28  
    29  	fuzzT.CleanupTempDirs()
    30  
    31  	fi, err = os.Stat(tDir1)
    32  	if err == nil {
    33  		panic(err)
    34  	}
    35  	if fi != nil {
    36  		t.Fatal("fi is not nil")
    37  	}
    38  
    39  	fi, err = os.Stat(tDir2)
    40  	if err == nil {
    41  		panic(err)
    42  	}
    43  	if fi != nil {
    44  		t.Fatal("fi is not nil")
    45  	}
    46  }
    47  

View as plain text