Skip to content

Commit

Permalink
pooled: add Label*Cond tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wazazaby committed Oct 8, 2023
1 parent 2d191d9 commit af34b8f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pooled/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ func TestBuilder(t *testing.T) {
}
}

func TestLabelCond(t *testing.T) {
result := Builder("test_cond",
LabelCond(func() bool { return true }, "should", "appear"),
LabelCond(func() bool { return false }, "should", "not"),
LabelQuoteCond(func() bool { return true }, "present", `/and/"quoted"`),
LabelQuoteCond(func() bool { return false }, "absent", `/and/"quoted"`),
)
require.Equal(t, `test_cond{should="appear",present="/and/\"quoted\""}`, result)
}

func BenchmarkBuilderTestCases(b *testing.B) {
for _, tc := range testCases {
if tc.mustPanic { // Skip test cases that panics as they will break the benchmarks.
Expand Down

0 comments on commit af34b8f

Please sign in to comment.