renamed src folder

This commit is contained in:
Theis
2024-03-03 11:05:32 +01:00
parent 4115ac23c8
commit 795c0fe12e
3 changed files with 0 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
package main
import (
"os"
"os/exec"
"testing"
)
func Test_emptyInput(t *testing.T) {
authors := make(map[string]user)
authors["test"] = user{username: "test", email: "test"}
if os.Getenv("BE_CRASHER") == "1" {
NoInput([]string{}, authors)
return
}
cmd := exec.Command(os.Args[0], "-test.run=Test_emptyInput")
cmd.Env = append(os.Environ(), "BE_CRASHER=1")
err := cmd.Run()
if e, ok := err.(*exec.ExitError); ok && !e.Success() {
return
}
t.Fatalf("process ran with err %v, want exit status 1", err)
}
func Test_usersInput(t *testing.T) {
authors := make(map[string]user)
authors["test"] = user{username: "test", email: "test"}
if os.Getenv("BE_CRASHER") == "1" {
NoInput([]string{"users"}, authors)
return
}
cmd := exec.Command(os.Args[0], "-test.run=Test_usersInput")
cmd.Env = append(os.Environ(), "BE_CRASHER=1")
err := cmd.Run()
if e, ok := err.(*exec.ExitError); ok && !e.Success() {
return
}
t.Fatalf("process ran with err %v, want exit status 1", err)
}