mirror of
https://github.com/luxfi/zapdb.git
synced 2026-10-30 15:12:20 +00:00
34 lines
845 B
Go
34 lines
845 B
Go
/*
|
|
* SPDX-FileCopyrightText: © 2017-2025 Istari Digital, Inc.
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
package y
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestCombineWithBothErrorsPresent(t *testing.T) {
|
|
combinedError := CombineErrors(errors.New("one"), errors.New("two"))
|
|
require.Equal(t, "one; two", combinedError.Error())
|
|
}
|
|
|
|
func TestCombineErrorsWithOneErrorPresent(t *testing.T) {
|
|
combinedError := CombineErrors(errors.New("one"), nil)
|
|
require.Equal(t, "one", combinedError.Error())
|
|
}
|
|
|
|
func TestCombineErrorsWithOtherErrorPresent(t *testing.T) {
|
|
combinedError := CombineErrors(nil, errors.New("other"))
|
|
require.Equal(t, "other", combinedError.Error())
|
|
}
|
|
|
|
func TestCombineErrorsWithBothErrorsAsNil(t *testing.T) {
|
|
combinedError := CombineErrors(nil, nil)
|
|
require.NoError(t, combinedError)
|
|
}
|