Repository: stretchr/testify
Pull request #856 (2019-12-12 17:10:10)

Add some project docs
Let's make things a little easier on people and provide some help for new maintainers!

@boyan-soubachov FYI


Patch:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..e155426
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,50 @@
+# Contributing to Testify
+
+So you'd like to contribute to Testify? First of all, thank you! Testify is widely used, so each
+contribution has a significant impact within the Golang community! Below you'll find everything you
+need to know to get up to speed on the project.
+
+## Philosophy
+
+The Testify maintainers generally attempt to follow widely accepted practices within the Golang
+community. That being said, the first priority is always to make sure that the package is useful to
+the community. A few general guidelines are listed here:
+
+*Keep it simple (whenever practical)* - Try not to expand the API unless the new surface area
+provides meaningful benefits. For example, don't add functions because they might be useful to
+someone, someday. Add what is useful to specific users, today.
+
+*Ease of use is paramount* - This means good documentation and package organization. It also means
+that we should try hard to use meaningful, descriptive function names, avoid breaking the API
+unnecessarily, and try not to surprise the user.
+
+*Quality isn't an afterthought* - Testify is a testing library, so it seems reasonable that we
+should have a decent test suite. This is doubly important because a bug in Testify doesn't just mean
+a bug in our users' code, it means a bug in our users' tests, which means a potentially unnoticed
+and hard-to-find bug in our users' code.
+
+## Pull Requests
+
+We welcome pull requests! Please include the following in the description:
+
+  * Motivation, why your change is important or helpful
+  * Example usage (if applicable)
+  * Whether you intend to add / change behavior or fix a bug
+
+Please be aware that the maintainers may ask for changes. This isn't a commentary on the quality of
+your idea or your code. Testify is the result of many contributions from many individuals, so we
+need to enforce certain practices and patterns to keep the package easy for others to understand.
+Essentially, we recognize that there are often many good ways to do a given thing, but we have to
+pick one and stick with it.
+
+See `MAINTAINERS.md` for a list of users who can approve / merge your changes.
+
+## Issues
+
+If you find a bug or think of a useful feature you'd like to see added to Testify, the best thing
+you can do is make the necessary changes and open a pull requests (see above). If that isn't an
+option, or if you'd like to discuss your change before you write the code, open an issue!
+
+Please provide enough context in the issue description that other members of the community can
+easily understand what it is that you'd like to see.
+
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..078dcee
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,8 @@
+# Testify Maintainers
+
+The individuals listed below are active in the project and have the ability to approve and merge
+pull requests.
+
+  * @glesica
+  * @boyan-soubachov
+
diff --git a/README.md b/README.md
index 976e77a..74b3191 100644
--- a/README.md
+++ b/README.md
@@ -334,6 +334,8 @@ When submitting an issue, we ask that you please include a complete test functio
 
 Code generation is used. Look for `CODE GENERATED AUTOMATICALLY` at the top of some files. Run `go generate ./...` to update generated files.
 
+We also chat on the [Gophers Slack](https://gophers.slack.com) group in the `#testify` and `#testify-dev` channels.
+
 ------
 
 License
diff --git a/assert/assertion_format.go b/assert/assertion_format.go
index 7804ff0..8dbfc87 100644
--- a/assert/assertion_format.go
+++ b/assert/assertion_format.go
@@ -32,7 +32,8 @@ func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args
 	return Contains(t, s, contains, append([]interface{}{msg}, args...)...)
 }
 
-// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+// DirExistsf checks whether a directory exists in the given path. It also fails
+// if the path is a file rather a directory or there is an error checking whether it exists.
 func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
 	if h, ok := t.(tHelper); ok {
 		h.Helper()
@@ -160,7 +161,8 @@ func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {
 	return False(t, value, append([]interface{}{msg}, args...)...)
 }
 
-// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+// FileExistsf checks whether a file exists in the given path. It also fails if
+// the path points to a directory or there is an error when trying to check the file.
 func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
 	if h, ok := t.(tHelper); ok {
 		h.Helper()
@@ -371,6 +373,15 @@ func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool
 	return Nil(t, object, append([]interface{}{msg}, args...)...)
 }
 
+// NoDirExistsf checks whether a directory does not exist in the given path.
+// It fails if the path points to an existing _directory_ only.
+func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
+	if h, ok := t.(tHelper); ok {
+		h.Helper()
+	}
+	return NoDirExists(t, path, append([]interface{}{msg}, args...)...)
+}
+
 // NoErrorf asserts that a function returned no error (i.e. `nil`).
 //
 //   actualObj, err := SomeFunction()
@@ -384,6 +395,15 @@ func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {
 	return NoError(t, err, append([]interface{}{msg}, args...)...)
 }
 
+// NoFileExistsf checks whether a file does not exist in a given path. It fails
+// if the path points to an existing _file_ only.
+func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
+	if h, ok := t.(tHelper); ok {
+		h.Helper()
+	}
+	return NoFileExists(t, path, append([]interface{}{msg}, args...)...)
+}
+
 // NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
 // specified substring or element.
 //
diff --git a/assert/assertion_forward.go b/assert/assertion_forward.go
index cd9c7ef..f056de6 100644
--- a/assert/assertion_forward.go
+++ b/assert/assertion_forward.go
@@ -53,7 +53,8 @@ func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string,
 	return Containsf(a.t, s, contains, msg, args...)
 }
 
-// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+// DirExists checks whether a directory exists in the given path. It also fails
+// if the path is a file rather a directory or there is an error checking whether it exists.
 func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool {
 	if h, ok := a.t.(tHelper); ok {
 		h.Helper()
@@ -61,7 +62,8 @@ func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool {
 	return DirExists(a.t, path, msgAndArgs...)
 }
 
-// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+// DirExistsf checks whether a directory exists in the given path. It also fails
+// if the path is a file rather a directory or there is an error checking whether it exists.
 func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool {
 	if h, ok := a.t.(tHelper); ok {
 		h.Helper()
@@ -309,7 +311,8 @@ func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool {
 	return Falsef(a.t, value, msg, args...)
 }
 
-// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+// FileExists checks whether a file exists in the given path. It also fails if
+// the path points to a directory or there is an error when trying to check the file.
 func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool {
 	if h, ok := a.t.(tHelper); ok {
 		h.Helper()
@@ -317,7 +320,8 @@ func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool {
 	return FileExists(a.t, path, msgAndArgs...)
 }
 
-// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+// FileExistsf checks whether a file exists in the given path. It also fails if
+// the path points to a directory or there is an error when trying to check the file.
 func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool {
 	if h, ok := a.t.(tHelper); ok {
 		h.Helper()
@@ -731,6 +735,24 @@ func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) b
 	return Nilf(a.t, object, msg, args...)
 }
 
+// NoDirExists checks whether a directory does not exist in the given path.
+// It fails if the path points to an existing _directory_ only.
+func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) bool {
+	if h, ok := a.t.(tHelper); ok {
+		h.Helper()
+	}
+	return NoDirExists(a.t, path, msgAndArgs...)
+}
+
+// NoDirExistsf checks whether a directory does not exist in the given path.
+// It fails if the path points to an existing _directory_ only.
+func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) bool {
+	if h, ok := a.t.(tHelper); ok {
+		h.Helper()
+	}
+	return NoDirExistsf(a.t, path, msg, args...)
+}
+
 // NoError asserts that a function returned no error (i.e. `nil`).
 //
 //   actualObj, err := SomeFunction()
@@ -757,6 +779,24 @@ func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool {
 	return NoErrorf(a.t, err, msg, args...)
 }
 
+// NoFileExists checks whether a file does not exist in a given path. It fails
+// if the path points to an existing _file_ only.
+func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) bool {
+	if h, ok := a.t.(tHelper); ok {
+		h.Helper()
+	}
+	return NoFileExists(a.t, path, msgAndArgs...)
+}
+
+// NoFileExistsf checks whether a file does not exist in a given path. It fails
+// if the path points to an existing _file_ only.
+func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) bool {
+	if h, ok := a.t.(tHelper); ok {
+		h.Helper()
+	}
+	return NoFileExistsf(a.t, path, msg, args...)
+}
+
 // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
 // specified substring or element.
 //
diff --git a/assert/assertions.go b/assert/assertions.go
index 2ff827a..8747573 100644
--- a/assert/assertions.go
+++ b/assert/assertions.go
@@ -1364,7 +1364,8 @@ func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
 	return true
 }
 
-// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+// FileExists checks whether a file exists in the given path. It also fails if
+// the path points to a directory or there is an error when trying to check the file.
 func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
 	if h, ok := t.(tHelper); ok {
 		h.Helper()
@@ -1382,7 +1383,24 @@ func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
 	return true
 }
 
-// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+// NoFileExists checks whether a file does not exist in a given path. It fails
+// if the path points to an existing _file_ only.
+func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
+	if h, ok := t.(tHelper); ok {
+		h.Helper()
+	}
+	info, err := os.Lstat(path)
+	if err != nil {
+		return true
+	}
+	if info.IsDir() {
+		return true
+	}
+	return Fail(t, fmt.Sprintf("file %q exists", path), msgAndArgs...)
+}
+
+// DirExists checks whether a directory exists in the given path. It also fails
+// if the path is a file rather a directory or there is an error checking whether it exists.
 func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
 	if h, ok := t.(tHelper); ok {
 		h.Helper()
@@ -1400,6 +1418,25 @@ func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
 	return true
 }
 
+// NoDirExists checks whether a directory does not exist in the given path.
+// It fails if the path points to an existing _directory_ only.
+func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
+	if h, ok := t.(tHelper); ok {
+		h.Helper()
+	}
+	info, err := os.Lstat(path)
+	if err != nil {
+		if os.IsNotExist(err) {
+			return true
+		}
+		return true
+	}
+	if !info.IsDir() {
+		return true
+	}
+	return Fail(t, fmt.Sprintf("directory %q exists", path), msgAndArgs...)
+}
+
 // JSONEq asserts that two JSON strings are equivalent.
 //
 //  assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
diff --git a/go.sum b/go.sum
index cccb647..565b1c3 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,6 @@
 github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
diff --git a/require/require.go b/require/require.go
index 1bfb086..521958f 100644
--- a/require/require.go
+++ b/require/require.go
@@ -66,7 +66,8 @@ func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args
 	t.FailNow()
 }
 
-// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+// DirExists checks whether a directory exists in the given path. It also fails
+// if the path is a file rather a directory or there is an error checking whether it exists.
 func DirExists(t TestingT, path string, msgAndArgs ...interface{}) {
 	if h, ok := t.(tHelper); ok {
 		h.Helper()
@@ -77,7 +78,8 @@ func DirExists(t TestingT, path string, msgAndArgs ...interface{}) {
 	t.FailNow()
 }
 
-// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+// DirExistsf checks whether a directory exists in the given path. It also fails
+// if the path is a file rather a directory or there is an error checking whether it exists.
 func DirExistsf(t TestingT, path string, msg string, args ...interface{}) {
 	if h, ok := t.(tHelper); ok {
 		h.Helper()
@@ -394,7 +396,8 @@ func Falsef(t TestingT, value bool, msg string, args ...interface{}) {
 	t.FailNow()
 }
 
-// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+// FileExists checks whether a file exists in the given path. It also fails if
+// the path points to a directory or there is an error when trying to check the file.
 func FileExists(t TestingT, path string, msgAndArgs ...interface{}) {
 	if h, ok := t.(tHelper); ok {
 		h.Helper()
@@ -405,7 +408,8 @@ func FileExists(t TestingT, path string, msgAndArgs ...interface{}) {
 	t.FailNow()
 }
 
-// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+// FileExistsf checks whether a file exists in the given path. It also fails if
+// the path points to a directory or there is an error when trying to check the file.
 func FileExistsf(t TestingT, path string, msg string, args ...interface{}) {
 	if h, ok := t.(tHelper); ok {
 		h.Helper()
@@ -936,6 +940,30 @@ func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) {
 	t.FailNow()
 }
 
+// NoDirExists checks whether a directory does not exist in the given path.
+// It fails if the path points to an existing _directory_ only.
+func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) {
+	if h, ok := t.(tHelper); ok {
+		h.Helper()
+	}
+	if assert.NoDirExists(t, path, msgAndArgs...) {
+		return
+	}
+	t.FailNow()
+}
+
+// NoDirExistsf checks whether a directory does not exist in the given path.
+// It fails if the path points to an existing _directory_ only.
+func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) {
+	if h, ok := t.(tHelper); ok {
+		h.Helper()
+	}
+	if assert.NoDirExistsf(t, path, msg, args...) {
+		return
+	}
+	t.FailNow()
+}
+
 // NoError asserts that a function returned no error (i.e. `nil`).
 //
 //   actualObj, err := SomeFunction()
@@ -968,6 +996,30 @@ func NoErrorf(t TestingT, err error, msg string, args ...interface{}) {
 	t.FailNow()
 }
 
+// NoFileExists checks whether a file does not exist in a given path. It fails
+// if the path points to an existing _file_ only.
+func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) {
+	if h, ok := t.(tHelper); ok {
+		h.Helper()
+	}
+	if assert.NoFileExists(t, path, msgAndArgs...) {
+		return
+	}
+	t.FailNow()
+}
+
+// NoFileExistsf checks whether a file does not exist in a given path. It fails
+// if the path points to an existing _file_ only.
+func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) {
+	if h, ok := t.(tHelper); ok {
+		h.Helper()
+	}
+	if assert.NoFileExistsf(t, path, msg, args...) {
+		return
+	}
+	t.FailNow()
+}
+
 // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
 // specified substring or element.
 //
diff --git a/require/require_forward.go b/require/require_forward.go
index 11326bf..57681d1 100644
--- a/require/require_forward.go
+++ b/require/require_forward.go
@@ -54,7 +54,8 @@ func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string,
 	Containsf(a.t, s, contains, msg, args...)
 }
 
-// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+// DirExists checks whether a directory exists in the given path. It also fails
+// if the path is a file rather a directory or there is an error checking whether it exists.
 func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) {
 	if h, ok := a.t.(tHelper); ok {
 		h.Helper()
@@ -62,7 +63,8 @@ func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) {
 	DirExists(a.t, path, msgAndArgs...)
 }
 
-// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+// DirExistsf checks whether a directory exists in the given path. It also fails
+// if the path is a file rather a directory or there is an error checking whether it exists.
 func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) {
 	if h, ok := a.t.(tHelper); ok {
 		h.Helper()
@@ -310,7 +312,8 @@ func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) {
 	Falsef(a.t, value, msg, args...)
 }
 
-// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+// FileExists checks whether a file exists in the given path. It also fails if
+// the path points to a directory or there is an error when trying to check the file.
 func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) {
 	if h, ok := a.t.(tHelper); ok {
 		h.Helper()
@@ -318,7 +321,8 @@ func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) {
 	FileExists(a.t, path, msgAndArgs...)
 }
 
-// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+// FileExistsf checks whether a file exists in the given path. It also fails if
+// the path points to a directory or there is an error when trying to check the file.
 func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) {
 	if h, ok := a.t.(tHelper); ok {
 		h.Helper()
@@ -732,6 +736,24 @@ func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) {
 	Nilf(a.t, object, msg, args...)
 }
 
+// NoDirExists checks whether a directory does not exist in the given path.
+// It fails if the path points to an existing _directory_ only.
+func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) {
+	if h, ok := a.t.(tHelper); ok {
+		h.Helper()
+	}
+	NoDirExists(a.t, path, msgAndArgs...)
+}
+
+// NoDirExistsf checks whether a directory does not exist in the given path.
+// It fails if the path points to an existing _directory_ only.
+func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) {
+	if h, ok := a.t.(tHelper); ok {
+		h.Helper()
+	}
+	NoDirExistsf(a.t, path, msg, args...)
+}
+
 // NoError asserts that a function returned no error (i.e. `nil`).
 //
 //   actualObj, err := SomeFunction()
@@ -758,6 +780,24 @@ func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) {
 	NoErrorf(a.t, err, msg, args...)
 }
 
+// NoFileExists checks whether a file does not exist in a given path. It fails
+// if the path points to an existing _file_ only.
+func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) {
+	if h, ok := a.t.(tHelper); ok {
+		h.Helper()
+	}
+	NoFileExists(a.t, path, msgAndArgs...)
+}
+
+// NoFileExistsf checks whether a file does not exist in a given path. It fails
+// if the path points to an existing _file_ only.
+func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) {
+	if h, ok := a.t.(tHelper); ok {
+		h.Helper()
+	}
+	NoFileExistsf(a.t, path, msg, args...)
+}
+
 // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
 // specified substring or element.
 //


Test patch:
diff --git a/assert/assertions_test.go b/assert/assertions_test.go
index 2aafb25..f398820 100644
--- a/assert/assertions_test.go
+++ b/assert/assertions_test.go
@@ -1471,6 +1471,80 @@ func TestFileExists(t *testing.T) {
 
 	mockT = new(testing.T)
 	False(t, FileExists(mockT, "../_codegen"))
+
+	var tempFiles []string
+
+	link, err := getTempSymlinkPath("assertions.go")
+	if err != nil {
+		t.Fatal("could not create temp symlink, err:", err)
+	}
+	tempFiles = append(tempFiles, link)
+	mockT = new(testing.T)
+	True(t, FileExists(mockT, link))
+
+	link, err = getTempSymlinkPath("non_existent_file")
+	if err != nil {
+		t.Fatal("could not create temp symlink, err:", err)
+	}
+	tempFiles = append(tempFiles, link)
+	mockT = new(testing.T)
+	True(t, FileExists(mockT, link))
+
+	errs := cleanUpTempFiles(tempFiles)
+	if len(errs) > 0 {
+		t.Fatal("could not clean up temporary files")
+	}
+}
+
+func TestNoFileExists(t *testing.T) {
+	mockT := new(testing.T)
+	False(t, NoFileExists(mockT, "assertions.go"))
+
+	mockT = new(testing.T)
+	True(t, NoFileExists(mockT, "non_existent_file"))
+
+	mockT = new(testing.T)
+	True(t, NoFileExists(mockT, "../_codegen"))
+
+	var tempFiles []string
+
+	link, err := getTempSymlinkPath("assertions.go")
+	if err != nil {
+		t.Fatal("could not create temp symlink, err:", err)
+	}
+	tempFiles = append(tempFiles, link)
+	mockT = new(testing.T)
+	False(t, NoFileExists(mockT, link))
+
+	link, err = getTempSymlinkPath("non_existent_file")
+	if err != nil {
+		t.Fatal("could not create temp symlink, err:", err)
+	}
+	tempFiles = append(tempFiles, link)
+	mockT = new(testing.T)
+	False(t, NoFileExists(mockT, link))
+
+	errs := cleanUpTempFiles(tempFiles)
+	if len(errs) > 0 {
+		t.Fatal("could not clean up temporary files")
+	}
+}
+
+func getTempSymlinkPath(file string) (string, error) {
+	link := file + "_symlink"
+	err := os.Symlink(file, link)
+	return link, err
+}
+
+func cleanUpTempFiles(paths []string) []error {
+	var res []error
+	for _, path := range paths {
+		err := os.Remove(path)
+		if err != nil {
+			res = append(res, err)
+		}
+	}
+	return res
 }
 
 func TestDirExists(t *testing.T) {
@@ -1478,10 +1552,67 @@ func TestDirExists(t *testing.T) {
 	False(t, DirExists(mockT, "assertions.go"))
 
 	mockT = new(testing.T)
-	False(t, DirExists(mockT, "random_dir"))
+	False(t, DirExists(mockT, "non_existent_dir"))
 
 	mockT = new(testing.T)
 	True(t, DirExists(mockT, "../_codegen"))
+
+	var tempFiles []string
+
+	link, err := getTempSymlinkPath("assertions.go")
+	if err != nil {
+		t.Fatal("could not create temp symlink, err:", err)
+	}
+	tempFiles = append(tempFiles, link)
+	mockT = new(testing.T)
+	False(t, DirExists(mockT, link))
+
+	link, err = getTempSymlinkPath("non_existent_dir")
+	if err != nil {
+		t.Fatal("could not create temp symlink, err:", err)
+	}
+	tempFiles = append(tempFiles, link)
+	mockT = new(testing.T)
+	False(t, DirExists(mockT, link))
+
+	errs := cleanUpTempFiles(tempFiles)
+	if len(errs) > 0 {
+		t.Fatal("could not clean up temporary files")
+	}
+}
+
+func TestNoDirExists(t *testing.T) {
+	mockT := new(testing.T)
+	True(t, NoDirExists(mockT, "assertions.go"))
+
+	mockT = new(testing.T)
+	True(t, NoDirExists(mockT, "non_existent_dir"))
+
+	mockT = new(testing.T)
+	False(t, NoDirExists(mockT, "../_codegen"))
+
+	var tempFiles []string
+
+	link, err := getTempSymlinkPath("assertions.go")
+	if err != nil {
+		t.Fatal("could not create temp symlink, err:", err)
+	}
+	tempFiles = append(tempFiles, link)
+	mockT = new(testing.T)
+	True(t, NoDirExists(mockT, link))
+
+	link, err = getTempSymlinkPath("non_existent_dir")
+	if err != nil {
+		t.Fatal("could not create temp symlink, err:", err)
+	}
+	tempFiles = append(tempFiles, link)
+	mockT = new(testing.T)
+	True(t, NoDirExists(mockT, link))
+
+	errs := cleanUpTempFiles(tempFiles)
+	if len(errs) > 0 {
+		t.Fatal("could not clean up temporary files")
+	}
 }
 
 func TestJSONEq_EqualSONString(t *testing.T) {