Skip to content

Commit

Permalink
modfile: add retract directives to TestParseLax
Browse files Browse the repository at this point in the history
Old versions of modfile before CL 228039 should be able to parse and
ignore retract directives with version intervals.

Updates golang/go#24031

Change-Id: I0f35261997c0704a785ea8467dc5ed0738549966
Reviewed-on: https://go-review.googlesource.com/c/mod/+/230697
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
  • Loading branch information
Jay Conrod committed Apr 29, 2020
1 parent 2addee1 commit 60cb782
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion modfile/read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,24 @@ func TestParseLax(t *testing.T) {
)
exclude v1.2.3
replace <-!!!
retract v1.2.3 v1.2.4
retract (v1.2.3, v1.2.4]
retract v1.2.3 (
key1 value1
key2 value2
)
require good v1.0.0
`)
_, err := ParseLax("file", badFile, nil)
f, err := ParseLax("file", badFile, nil)
if err != nil {
t.Fatalf("ParseLax did not ignore irrelevant errors: %v", err)
}
if f.Module == nil || f.Module.Mod.Path != "m" {
t.Errorf("module directive was not parsed")
}
if len(f.Require) != 1 || f.Require[0].Mod.Path != "good" {
t.Errorf("require directive at end of file was not parsed")
}
}

// Test that when files in the testdata directory are parsed
Expand Down

0 comments on commit 60cb782

Please sign in to comment.