show-rss/main_test.go

23 lines
390 B
Go

package main_test
import (
"context"
"os"
"path"
main "show-rss"
"show-rss/src/db"
"testing"
"time"
)
func TestMain(t *testing.T) {
ctx, can := context.WithTimeout(context.Background(), 2*time.Second)
defer can()
os.Args = []string{os.Args[0], "-db", path.Join(t.TempDir(), "db.db")}
if err := main.Main(db.Test(t, ctx)); err != nil && ctx.Err() == nil {
t.Fatal(err)
}
}