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

Function TestWebBundleHasDeterministicCbor

go/internal/cbor/deterministic_test.go:291–305  ·  view source on GitHub ↗

The test web bundle have generated only contains deterministic CBOR. This test is to make sure that we don't accidentally break our deterministic checker. It contains a lot of nested CBOR types so it might catch something that has not been covered with other tests.

(t *testing.T)

Source from the content-addressed store, hash-verified

289// sure that we don't accidentally break our deterministic checker. It contains a lot of
290// nested CBOR types so it might catch something that has not been covered with other tests.
291func TestWebBundleHasDeterministicCbor(t *testing.T) {
292 bundleFile, err := os.Open("../../integrityblock/testfile.wbn")
293 if err != nil {
294 t.Error("Failed to open the test file")
295 }
296 defer bundleFile.Close()
297 bundleBytes, err := ioutil.ReadAll(bundleFile)
298 if err != nil {
299 t.Error("Failed to read the test file")
300 }
301
302 if err := Deterministic(bundleBytes); err != nil {
303 t.Error("testfile.wbn only contains deterministic CBOR and this shouldn't fail.")
304 }
305}
306
307// Helper functions:
308

Callers

nothing calls this directly

Calls 1

DeterministicFunction · 0.85

Tested by

no test coverage detected