We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 79bc001 commit 8fb51e4Copy full SHA for 8fb51e4
1 file changed
property_test.go
@@ -1,6 +1,7 @@
1
package errorx
2
3
import (
4
+ "fmt"
5
"testing"
6
7
"github.com/stretchr/testify/require"
@@ -107,3 +108,20 @@ func TestProperty(t *testing.T) {
107
108
require.Nil(t, property1)
109
})
110
}
111
+
112
+func BenchmarkAllocProperty(b *testing.B) {
113
+ const N = 9
114
+ var properties = []Property{}
115
+ for j := 0; j < N; j++ {
116
+ n := fmt.Sprintf("props%d", j)
117
+ properties = append(properties, RegisterProperty(n))
118
+ b.Run(n, func(b *testing.B) {
119
+ for k := 0; k < b.N; k++ {
120
+ err := testTypeSilent.New("test")
121
+ for i := 0; i < j; i++ {
122
+ err = err.WithProperty(properties[i], 42)
123
+ }
124
125
+ })
126
127
+}
0 commit comments