Skip to content

Commit

Permalink
test: removed empty lines before output in examples (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
sttk committed Aug 3, 2023
1 parent c340df8 commit e57d4dd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
12 changes: 0 additions & 12 deletions example_err_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func ExampleNewErr() {
Param2: 123,
}, cause)
fmt.Printf("(4) %v\n", err)

// Output:
// (1) {reason=FailToDoSomething}
// (2) {reason=FailToDoSomethingWithParams, Param1=ABC, Param2=123}
Expand All @@ -51,7 +50,6 @@ func ExampleOk() {
err := sabi.Ok()
fmt.Printf("err = %v\n", err)
fmt.Printf("err.IsOk() = %v\n", err.IsOk())

// Output:
// err = {reason=nil}
// err.IsOk() = true
Expand All @@ -64,7 +62,6 @@ func ExampleErr_Cause() {

err := sabi.NewErr(FailToDoSomething{}, cause)
fmt.Printf("%v\n", err.Cause())

// Output:
// Causal error
}
Expand All @@ -82,7 +79,6 @@ func ExampleErr_Error() {
Param2: 123,
}, cause)
fmt.Printf("%v\n", err.Error())

// Output:
// {reason=FailToDoSomething, Param1=ABC, Param2=123, cause=Causal error}
}
Expand All @@ -100,7 +96,6 @@ func ExampleErr_Get() {
fmt.Printf("Param1=%v\n", err.Get("Param1"))
fmt.Printf("Param2=%v\n", err.Get("Param2"))
fmt.Printf("Param3=%v\n", err.Get("Param3"))

// Output:
// Param1=ABC
// Param2=123
Expand All @@ -114,7 +109,6 @@ func ExampleErr_IsOk() {
type FailToDoSomething struct{}
err = sabi.NewErr(FailToDoSomething{})
fmt.Printf("%v\n", err.IsOk())

// Output:
// true
// false
Expand All @@ -140,7 +134,6 @@ func ExampleErr_Reason() {
reason := err.Reason().(*FailToDoSomething)
fmt.Printf("The value of reason.Param1 is: %v\n", reason.Param1)
}

// Output:
// The reason of the error is: FailToDoSomething
// The value of reason.Param1 is: value1
Expand All @@ -153,7 +146,6 @@ func ExampleErr_ReasonName() {

err := sabi.NewErr(FailToDoSomething{})
fmt.Printf("%v\n", err.ReasonName())

// Output:
// FailToDoSomething
}
Expand All @@ -163,7 +155,6 @@ func ExampleErr_ReasonPackage() {

err := sabi.NewErr(FailToDoSomething{})
fmt.Printf("%v\n", err.ReasonPackage())

// Output:
// github.com/sttk/sabi_test
}
Expand All @@ -179,7 +170,6 @@ func ExampleErr_Situation() {
Param2: 123,
})
fmt.Printf("%v\n", err.Situation())

// Output:
// map[Param1:ABC Param2:123]
}
Expand All @@ -198,7 +188,6 @@ func ExampleErr_Unwrap() {
fmt.Printf("errors.Is(err, cause2) = %v\n", errors.Is(err, cause2))
fmt.Printf("errors.As(err, cause1) = %v\n", errors.Is(err, cause1))
fmt.Printf("errors.As(err, cause2) = %v\n", errors.Is(err, cause2))

// Output:
// err.Unwrap() = Causal error 1
// errors.Unwrap(err) = Causal error 1
Expand All @@ -222,7 +211,6 @@ func ExampleErr_IfOk() {
fmt.Println("not execute if some error.")
return sabi.Ok()
})

// Output:
// execute if non error.
}
5 changes: 1 addition & 4 deletions example_notify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func ExampleAddAsyncErrHandler() {
type FailToDoSomething struct{ Name string }

sabi.NewErr(FailToDoSomething{Name: "abc"})

// Output:
// Asynchronous error handling: {reason=FailToDoSomething, Name=abc}

Expand All @@ -34,7 +33,6 @@ func ExampleAddSyncErrHandler() {
type FailToDoSomething struct{ Name string }

sabi.NewErr(FailToDoSomething{Name: "abc"})

// Output:
// Synchronous error handling: {reason=FailToDoSomething, Name=abc}

Expand All @@ -56,9 +54,8 @@ func ExampleFixErrCfgs() {
type FailToDoSomething struct{ Name string }

sabi.NewErr(FailToDoSomething{Name: "abc"})

// Output:
// This handler is registered at example_notify_test.go:58
// This handler is registered at example_notify_test.go:56

sabi.ClearErrHandlers()
}

0 comments on commit e57d4dd

Please sign in to comment.