Skip to content

Commit c3d00eb

Browse files
bsheedy-workDawn LUCI CQ
authored andcommitted
Add get-test-plan coverage
Adds test coverage for //tools/src/cmd/get-test-plan/main.go that is currently possible with the amount of dependency injection that is in use. Also fixes several bugs in the code that were found as a result of the added test coverage. Bug: 344014313 Change-Id: Ice2e7a5a90aa4994afd1a7dd01172653c8bb25c3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/282856 Commit-Queue: dan sinclair <dsinclair@chromium.org> Auto-Submit: Brian Sheedy <bsheedy@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org>
1 parent d595fbd commit c3d00eb

File tree

2 files changed

+601
-3
lines changed

2 files changed

+601
-3
lines changed

tools/src/cmd/get-test-plan/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ var (
691691
reIrregularWhiteSpace = regexp.MustCompile(`§.`)
692692
)
693693

694-
// cleanUpString creates a string by removing all extra spaces, newlines and tabs
694+
// cleanUpString creates a string by removing all extra spaces, newlines and tabs
695695
// form input string 'in' and returns it
696696
// This is done so that the uniqueID does not change because of a change in white spaces
697697
//
@@ -904,7 +904,7 @@ func validationTestPlan(rules []rule, path string, start int, end int, fsWriter
904904
return err
905905
}
906906
section := sectionDims[0]
907-
if section < start || section >= end {
907+
if section < start || section > end {
908908
continue
909909
}
910910
content[section] = append(content[section], testPlan(r))
@@ -969,7 +969,7 @@ func executionTestPlan(rules []rule, path string, fsWriter oswrapper.FilesystemW
969969
index = sectionDims[1]
970970
}
971971

972-
if index < 0 && index >= len(content) {
972+
if index < 0 || index >= len(content) {
973973
return fmt.Errorf("cannot append to content, index %v out of range 0..%v",
974974
index, len(content)-1)
975975
}

0 commit comments

Comments
 (0)