Skip to content

Commit 5021ddf

Browse files
author
dmsa0618
committed
fix delimiter generation test
1 parent 51c2b2d commit 5021ddf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

config/v3/configV3_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package v3
1616

1717
import (
1818
"fmt"
19+
"regexp"
1920
"strings"
2021
"testing"
2122
"time"
@@ -442,7 +443,8 @@ func TestImportSuccess(t *testing.T) {
442443
}
443444

444445
func TestLineDelimiterGeneration(t *testing.T) {
445-
cfgWithoutDelimiter := strings.Replace(counter_config, "[\\s]*line_delimiter:[^\\n]*", "", 1)
446+
re := regexp.MustCompile("[\\s]*line_delimiter:[^\\n]*")
447+
cfgWithoutDelimiter := re.ReplaceAllString(counter_config, "")
446448
cfgWithDelimiter, err := Unmarshal([]byte(cfgWithoutDelimiter))
447449
if err != nil {
448450
t.Fatalf("unexpected unmarshalling error: %v", err)

0 commit comments

Comments
 (0)