From 024986eefa9f8bbb27715dc1f6bb5ccdb1d8f499 Mon Sep 17 00:00:00 2001 From: yshngg Date: Thu, 7 Aug 2025 10:48:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20(testcoverage)=20Correct=20examp?= =?UTF-8?q?le=20config=20to=20use=20`null`=20and=20add=20validation=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .testcoverage.example.yml | 4 ++-- pkg/testcoverage/config_test.go | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.testcoverage.example.yml b/.testcoverage.example.yml index 32f82a3..1292f48 100644 --- a/.testcoverage.example.yml +++ b/.testcoverage.example.yml @@ -60,7 +60,7 @@ diff: # Allowed threshold for the test coverage difference (in percentage) # between the feature branch and the base branch. # - # By default, this is disabled (set to nil). Valid values range from + # By default, this is disabled (set to null). Valid values range from # -100.0 to +100.0. # # Example: @@ -68,4 +68,4 @@ diff: # less than 0.5% more coverage than the base. # # If set to -0.5, the check allows up to 0.5% less coverage than the base. - threshold: nil \ No newline at end of file + threshold: null \ No newline at end of file diff --git a/pkg/testcoverage/config_test.go b/pkg/testcoverage/config_test.go index 3bf8f28..5bb3b55 100644 --- a/pkg/testcoverage/config_test.go +++ b/pkg/testcoverage/config_test.go @@ -213,6 +213,15 @@ func Test_ConfigFromFile(t *testing.T) { assert.NoError(t, err) assert.Equal(t, savedCfg, cfg) }) + + t.Run("example file", func(t *testing.T) { + t.Parallel() + + cfg := Config{} + filename := "../../.testcoverage.example.yml" + err := ConfigFromFile(&cfg, filename) + assert.NoError(t, err) + }) } func TestConfigYamlParse(t *testing.T) {