(t *testing.T)
| 85 | } |
| 86 | |
| 87 | func TestChainedReversePatches(t *testing.T) { |
| 88 | // Simulate version chain: v1 → v2 → v3 (current) |
| 89 | v1 := "Version 1 content" |
| 90 | v2 := "Version 2 content with changes" |
| 91 | v3 := "Version 3 content with more changes" |
| 92 | |
| 93 | // Store reverse patches (from newer → older) |
| 94 | patch3to2 := CreateReversePatch(v2, v3) // patch to go v3 → v2 |
| 95 | patch2to1 := CreateReversePatch(v1, v2) // patch to go v2 → v1 |
| 96 | |
| 97 | // Reconstruct v2 from v3 |
| 98 | got2, err := ApplyPatch(v3, patch3to2) |
| 99 | if err != nil { |
| 100 | t.Fatalf("reconstruct v2: %v", err) |
| 101 | } |
| 102 | if got2 != v2 { |
| 103 | t.Errorf("v2 reconstruction: expected %q, got %q", v2, got2) |
| 104 | } |
| 105 | |
| 106 | // Reconstruct v1 from v2 |
| 107 | got1, err := ApplyPatch(got2, patch2to1) |
| 108 | if err != nil { |
| 109 | t.Fatalf("reconstruct v1: %v", err) |
| 110 | } |
| 111 | if got1 != v1 { |
| 112 | t.Errorf("v1 reconstruction: expected %q, got %q", v1, got1) |
| 113 | } |
| 114 | } |
nothing calls this directly
no test coverage detected