main test
This commit is contained in:
13
main_test.go
13
main_test.go
@@ -2,21 +2,16 @@ package main_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os/signal"
|
||||
"show-rss/src/cmd"
|
||||
"syscall"
|
||||
main "show-rss"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestCmdMain(t *testing.T) {
|
||||
ctx, can := signal.NotifyContext(context.Background(), syscall.SIGINT)
|
||||
func TestMain(t *testing.T) {
|
||||
ctx, can := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer can()
|
||||
|
||||
ctx, can = context.WithTimeout(ctx, 5*time.Second)
|
||||
defer can()
|
||||
|
||||
if err := cmd.Main(ctx); err != nil && ctx.Err() == nil {
|
||||
if err := main.Main(ctx); err != nil && ctx.Err() == nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user