diff --git a/testing_data/catFile1.txt b/testing_data/catFile1.txt new file mode 100644 index 0000000..0651332 --- /dev/null +++ b/testing_data/catFile1.txt @@ -0,0 +1 @@ +Some simple text to see if it works \ No newline at end of file diff --git a/testing_data/catFile2.txt b/testing_data/catFile2.txt new file mode 100644 index 0000000..e9d648e --- /dev/null +++ b/testing_data/catFile2.txt @@ -0,0 +1 @@ +More data to see if it 100% works \ No newline at end of file diff --git a/utils_test.go b/utils_test.go index 7b3ba39..6d2de66 100644 --- a/utils_test.go +++ b/utils_test.go @@ -81,7 +81,7 @@ func TestCopyFileContents(t *testing.T) { } func TestCopyFile(t *testing.T) { - t.Run("Content copied successfully", func(t *testing.T) { + t.Run("Files copied successfully", func(t *testing.T) { f1 := "testing_data/README.md" f2 := "testing_data/CopyOfREADME.md" err := CopyFile(f1, f2) @@ -103,3 +103,17 @@ func TestCopyFile(t *testing.T) { os.Remove(f2) }) } + +func TestCatFiles(t *testing.T) { + t.Run("CatFiles passing", func(t *testing.T) { + files := []string{"testing_data/catFile1.txt", "testing_data/catFile2.txt"} + err := CatFiles(files, "testing_data/CatFile.txt", false) + if err != nil { + t.Errorf("should pass with no error, got: %v", err) + } + if _, err := os.Stat("testing_data/CatFile.txt"); os.IsNotExist(err) { + t.Errorf("file were not created: %v", err) + } + os.Remove("testing_data/CatFile.txt") + }) +}