---- Round-trip: Store then Restore gives back identical content ----
(t *testing.T)
| 301 | // ---- Round-trip: Store then Restore gives back identical content ---- |
| 302 | |
| 303 | func TestDevStoreRestore_RoundTrip(t *testing.T) { |
| 304 | cache := newTestDevArtifactCache(t) |
| 305 | pkgDir := makePackageDir(t, "boost@1.82.0") |
| 306 | |
| 307 | const meta = "round-trip-meta" |
| 308 | if err := cache.Store(pkgDir, meta); err != nil { |
| 309 | t.Fatal(err) |
| 310 | } |
| 311 | hash := computeHash(meta) |
| 312 | |
| 313 | destDir := filepath.Join(t.TempDir(), "roundtrip", "boost@1.82.0") |
| 314 | if _, err := cache.Restore("boost@1.82.0", hash, destDir); err != nil { |
| 315 | t.Fatal(err) |
| 316 | } |
| 317 | |
| 318 | // Compare original and restored file content. |
| 319 | orig, err := os.ReadFile(filepath.Join(pkgDir, "libfoo.a")) |
| 320 | if err != nil { |
| 321 | t.Fatal(err) |
| 322 | } |
| 323 | got, err := os.ReadFile(filepath.Join(destDir, "libfoo.a")) |
| 324 | if err != nil { |
| 325 | t.Fatal(err) |
| 326 | } |
| 327 | if string(orig) != string(got) { |
| 328 | t.Errorf("restored content differs: got %q, want %q", got, orig) |
| 329 | } |
| 330 | } |
nothing calls this directly
no test coverage detected