1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

better namespacing for assertions

This commit is contained in:
Jesse Duffield
2022-12-27 15:22:31 +11:00
parent be30cbb375
commit 09e80e5f2a
36 changed files with 328 additions and 294 deletions

View File

@ -0,0 +1,26 @@
package components
import (
"fmt"
"os"
)
type FileSystem struct {
*assertionHelper
}
// This does _not_ check the files panel, it actually checks the filesystem
func (self *FileSystem) PathPresent(path string) {
self.assertWithRetries(func() (bool, string) {
_, err := os.Stat(path)
return err == nil, fmt.Sprintf("Expected path '%s' to exist, but it does not", path)
})
}
// This does _not_ check the files panel, it actually checks the filesystem
func (self *FileSystem) PathNotPresent(path string) {
self.assertWithRetries(func() (bool, string) {
_, err := os.Stat(path)
return os.IsNotExist(err), fmt.Sprintf("Expected path '%s' to not exist, but it does", path)
})
}