Watch
1
0
Fork
You've already forked pkg-proxy
1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-11-09 07:39:19 -05:00
pkg-proxy/internal/mirror/cran_test.go
Simon Chrzanowski 842fa21c0a
Fetch archived CRAN versions unchecked and drop the version dedup
PACKAGES.rds comes from the same host as the tarball, so checking against it
doesn't justify a decoder for R serialization. The duplicate archived
versions are tracked in git-pkgs/registries#119.
2026-10-28 15:17:49 +00:00

27 lines
563 B
Go

package mirror
import (
"maps"
"testing"
)
func TestParseCRANPackages(t *testing.T) {
data := []byte(`Package: A3
Version: 1.0.0
Depends: R (>= 2.15.0), xtable,
pbapply
MD5sum: 027ebdd8affce8f0effaecfcd5f5ade2
NeedsCompilation: no
Package: abc
Version: 2.2.1
NeedsCompilation: no
`)
want := map[string]string{
"A3_1.0.0.tar.gz": "027ebdd8affce8f0effaecfcd5f5ade2",
"abc_2.2.1.tar.gz": "",
}
if got, err := parseCRANPackages(data); err != nil || !maps.Equal(got, want) {
t.Errorf("parseCRANPackages = %v, %v, want %v", got, err, want)
}
}