-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathpgo_test.go
More file actions
32 lines (27 loc) · 841 Bytes
/
pgo_test.go
File metadata and controls
32 lines (27 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2021 - 2026 Crunchy Data Solutions, Inc.
//
// SPDX-License-Identifier: Apache-2.0
package cmd
import (
"testing"
"gotest.tools/v3/assert"
)
func TestFormatHeader(t *testing.T) {
testsCases := []struct {
desc string
input string
output string
}{
{"Expected", "### Some Header\n", "Some Header:\n"},
{"One valid, one not", "### Some Header\n### Another Header", "Some Header:\n### Another Header"},
{"Two expected", "### Some Header\n### Another Header\n", "Some Header:\nAnother Header:\n"},
{"No newline", "### Some Header", "### Some Header"},
{"2 hashes", "## Some Header\n", "## Some Header\n"},
{"leading space", " ### Some Header\n", " Some Header:\n"},
}
for _, tc := range testsCases {
t.Run(tc.desc, func(t *testing.T) {
assert.Equal(t, formatHeader(tc.input), tc.output)
})
}
}