mirror of
https://github.com/onyx-and-iris/exclude.git
synced 2026-03-30 23:19:09 +00:00
add tests for all commands wrap entry point with fang add --version flag target to Taskfile
29 lines
538 B
Go
29 lines
538 B
Go
package cmd
|
|
|
|
import (
|
|
"bytes"
|
|
"io"
|
|
"testing"
|
|
)
|
|
|
|
func TestRunResetCommand(t *testing.T) {
|
|
var buf bytes.Buffer
|
|
|
|
if err := resetAndWriteExcludeFile(&buf); err != nil {
|
|
t.Fatalf("resetAndWriteExcludeFile failed: %v", err)
|
|
}
|
|
|
|
resetContent, err := io.ReadAll(&buf)
|
|
if err != nil {
|
|
t.Fatalf("failed to read from temp file: %v", err)
|
|
}
|
|
|
|
if string(resetContent) != defaultExcludeFileContent {
|
|
t.Errorf(
|
|
"unexpected content after reset:\nGot:\n%s\nExpected:\n%s",
|
|
string(resetContent),
|
|
defaultExcludeFileContent,
|
|
)
|
|
}
|
|
}
|