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