show-rss/main_test.go

23 lines
369 B
Go

package main_test
import (
"context"
"os/signal"
"show-rss/src/cmd"
"syscall"
"testing"
"time"
)
func TestCmdMain(t *testing.T) {
ctx, can := signal.NotifyContext(context.Background(), syscall.SIGINT)
defer can()
ctx, can = context.WithTimeout(ctx, 5*time.Second)
defer can()
if err := cmd.Main(ctx); err != nil && ctx.Err() == nil {
t.Fatal(err)
}
}