...

Source file src/edge-infra.dev/pkg/lib/filesystem/exists_test.go

Documentation: edge-infra.dev/pkg/lib/filesystem

     1  package filesystem
     2  
     3  import (
     4  	_ "embed"
     5  
     6  	gk "github.com/onsi/ginkgo/v2"
     7  	gm "github.com/onsi/gomega"
     8  )
     9  
    10  var _ = gk.Describe("File system exists suite", func() {
    11  	gk.It("directory does not exist", func() {
    12  		exists, err := Exists("noexist")
    13  		gm.Expect(err).To(gm.BeNil())
    14  		gm.Expect(exists).To(gm.BeFalse())
    15  	})
    16  	gk.It("directory and file do not exist", func() {
    17  		exists, err := Exists("noexist/noexist.txt")
    18  		gm.Expect(err).To(gm.BeNil())
    19  		gm.Expect(exists).To(gm.BeFalse())
    20  	})
    21  	gk.It("directory exists", func() {
    22  		exists, err := Exists("testdata")
    23  		gm.Expect(err).To(gm.BeNil())
    24  		gm.Expect(exists).To(gm.BeTrue())
    25  	})
    26  
    27  	gk.It("directory and file exist", func() {
    28  		exists, err := Exists("testdata/file1.txt")
    29  		gm.Expect(err).To(gm.BeNil())
    30  		gm.Expect(exists).To(gm.BeTrue())
    31  	})
    32  
    33  	gk.It("directory exists, file does not", func() {
    34  		exists, err := Exists("testdata/noexist.txt")
    35  		gm.Expect(err).To(gm.BeNil())
    36  		gm.Expect(exists).To(gm.BeFalse())
    37  	})
    38  })
    39  

View as plain text