Skip to content

Commit

Permalink
refactor result functions for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lainio committed Aug 17, 2024
1 parent fa9e3e8 commit 05a0684
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions err2_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package err2_test

import (
"errors"
"fmt"
"io"
"os"
Expand All @@ -14,18 +15,17 @@ import (

const errStringInThrow = "this is an ERROR"

func throw() (string, error) {
return "", fmt.Errorf(errStringInThrow)
}
var (
errToTest = errors.New(errStringInThrow)
)

func throw() (string, error) { return "", errToTest }
func noThrow() (string, error) { return "test", nil }
func noErr() error { return nil }

func twoStrNoThrow() (string, string, error) { return "test", "test", nil }
func intStrNoThrow() (int, string, error) { return 1, "test", nil }
func boolIntStrNoThrow() (bool, int, string, error) { return true, 1, "test", nil }
func noThrow() (string, error) { return "test", nil }

func noErr() error {
return nil
}

func TestTry_noError(t *testing.T) {
t.Parallel()
Expand Down

0 comments on commit 05a0684

Please sign in to comment.