zenity/notify_test.go
2021-06-18 15:10:22 +01:00

31 lines
587 B
Go

package zenity_test
import (
"context"
"errors"
"testing"
"github.com/ncruces/zenity"
"go.uber.org/goleak"
)
func ExampleNotify() {
zenity.Notify("There are system updates necessary!",
zenity.Title("Warning"),
zenity.InfoIcon)
// Output:
}
func TestNotify_cancel(t *testing.T) {
defer goleak.VerifyNone(t)
ctx, cancel := context.WithCancel(context.Background())
cancel()
err := zenity.Notify("text", zenity.Context(ctx))
if err, skip := skip(err); skip {
t.Skip("skipping:", err)
}
if !errors.Is(err, context.Canceled) {
t.Error("was not canceled:", err)
}
}