feat(parser/diff): add pass/fail comment to conf
All checks were successful
build / build (push) Successful in 1m2s
build / trigger-build-image (push) Successful in 9s

This commit is contained in:
张泊明518370910136 2024-10-12 01:53:08 -04:00
parent ad0918bbde
commit 2a2166f1ad
GPG Key ID: D47306D7062CDA9D

View File

@ -21,7 +21,9 @@ const (
) )
type Conf struct { type Conf struct {
Cases []struct { PassComment string `default:"🥳Passed!\n"`
FailComment string `default:"🧐Failed...\n"`
Cases []struct {
IgnoreResultStatus bool IgnoreResultStatus bool
Outputs []struct { Outputs []struct {
Score int Score int
@ -72,9 +74,9 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
if compareChars(string(answer), result.Files[output.FileName], if compareChars(string(answer), result.Files[output.FileName],
output.CompareSpace) { output.CompareSpace) {
score += output.Score score += output.Score
comment += "Pass!\n" comment += conf.PassComment
} else { } else {
comment += "Fail!\n" comment += conf.FailComment
comment += fmt.Sprintf("Difference found in `%s`.\n", comment += fmt.Sprintf("Difference found in `%s`.\n",
output.FileName) output.FileName)
if !output.AlwaysHide { if !output.AlwaysHide {