MCPcopy Create free account
hub / github.com/WICG/webpackage / TestWriteAndReadWithVariants

Function TestWriteAndReadWithVariants

go/bundle/bundle_test.go:132–151  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

130}
131
132func TestWriteAndReadWithVariants(t *testing.T) {
133 for _, ver := range version.AllVersions {
134 if !ver.SupportsVariants() {
135 continue
136 }
137 bundle := createTestBundleWithVariants(ver)
138
139 var buf bytes.Buffer
140 if _, err := bundle.WriteTo(&buf); err != nil {
141 t.Errorf("Bundle.WriteTo unexpectedly failed: %v", err)
142 }
143 deserialized, err := Read(&buf)
144 if err != nil {
145 t.Errorf("Bundle.Read unexpectedly failed: %v", err)
146 }
147 if !reflect.DeepEqual(deserialized, bundle) {
148 t.Errorf("got: %v\nwant: %v", deserialized, bundle)
149 }
150 }
151}
152
153func TestB2BundleWithSpecifiedManifestURLShouldFail(t *testing.T) {
154 bundle := createTestBundle(t, version.VersionB2)

Callers

nothing calls this directly

Calls 4

ReadFunction · 0.85
SupportsVariantsMethod · 0.80
WriteToMethod · 0.45

Tested by

no test coverage detected