Skip to content

Commit

Permalink
test: update signal test for error removal
Browse files Browse the repository at this point in the history
  • Loading branch information
nixpig committed Dec 27, 2024
1 parent 56a9218 commit cf1d51b
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions signal/signal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,31 @@ import (
)

func TestFromInt(t *testing.T) {
sig, err := signal.FromInt(9)
sig := signal.FromInt(9)
assert.Equal(t, syscall.SIGKILL, sig)
assert.NoError(t, err)
}

func TestFromIntInvalid(t *testing.T) {
sig, err := signal.FromInt(99)
sig := signal.FromInt(99)
assert.Equal(t, syscall.Signal(0), sig)
assert.Error(t, err)
}

func TestFromStringNumber(t *testing.T) {
sig, err := signal.FromString("10")
sig := signal.FromString("10")
assert.Equal(t, syscall.SIGUSR1, sig)
assert.NoError(t, err)
}

func TestFromStringShort(t *testing.T) {
sig, err := signal.FromString("CHLD")
sig := signal.FromString("CHLD")
assert.Equal(t, syscall.SIGCHLD, sig)
assert.NoError(t, err)
}

func TestFromStringLong(t *testing.T) {
sig, err := signal.FromString("SIGQUIT")
sig := signal.FromString("SIGQUIT")
assert.Equal(t, syscall.SIGQUIT, sig)
assert.NoError(t, err)
}

func TestFromStringInvalid(t *testing.T) {
sig, err := signal.FromString("something invalid")
sig := signal.FromString("something invalid")
assert.Equal(t, syscall.Signal(0), sig)
assert.Error(t, err)
}

0 comments on commit cf1d51b

Please sign in to comment.