Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21b7212
commit c940233
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,27 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
) | ||
|
||
var mockFile = "mock.tf" | ||
|
||
func TestContainsElement(t *testing.T) { | ||
testSlice := []string{"Terraform", "Puppet", "Ansible"} | ||
if containsElement(testSlice, "Chef") { | ||
t.Error("Should return false, but return true") | ||
} | ||
} | ||
|
||
func TestGetAllFiles(t *testing.T) { | ||
var file, err = os.Create(mockFile) | ||
checkError(err) | ||
defer file.Close() | ||
files, err := getAllFiles(tfFileExt) | ||
checkError(err) | ||
if len(files) == 0 { | ||
t.Error("Should found at least one file") | ||
} | ||
defer os.Remove(mockFile) | ||
} |