From 6fbbe7ece0a0659c3c859ddbe5b24abfb71a892a Mon Sep 17 00:00:00 2001 From: zzjc1234 <2359047351@qq.com> Date: Mon, 9 Sep 2024 13:08:29 +0800 Subject: [PATCH] feat: option ignoring whitespace --- internal/parsers/diff/parser.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/parsers/diff/parser.go b/internal/parsers/diff/parser.go index 0c32393..d56d037 100644 --- a/internal/parsers/diff/parser.go +++ b/internal/parsers/diff/parser.go @@ -13,7 +13,7 @@ type Conf struct { Cases []struct { Score int StdoutPath string - ignoreWhitespace bool + IgnoreWhitespace bool } } @@ -47,7 +47,7 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) ( ) // If no difference, assign score - if compareChars(string(stdout), result.Files["stdout"], caseConf.ignoreWhitespace) { + if compareChars(string(stdout), result.Files["stdout"], caseConf.IgnoreWhitespace) { score = caseConf.Score } else { // Convert stdout to string and split by lines @@ -55,7 +55,7 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) ( resultLines := strings.Split(result.Files["stdout"], "\n") // Find the first difference - diffIndex := findFirstDifferenceIndex(stdoutLines, resultLines, caseConf.ignoreWhitespace) + diffIndex := findFirstDifferenceIndex(stdoutLines, resultLines, caseConf.IgnoreWhitespace) if diffIndex != -1 { // Generate diff block with surrounding context diffOutput := generateDiffWithContext(stdoutLines, resultLines, diffIndex, 10)