(t *testing.T)
| 24 | } |
| 25 | |
| 26 | func TestReversePatch(t *testing.T) { |
| 27 | old := "# Document\n\nOriginal content here." |
| 28 | new := "# Document\n\nUpdated content here.\n\nNew section added." |
| 29 | |
| 30 | patch := CreateReversePatch(old, new) |
| 31 | if patch == "" { |
| 32 | t.Fatal("expected non-empty reverse patch") |
| 33 | } |
| 34 | |
| 35 | // Applying reverse patch to new content should give old content |
| 36 | result, err := ApplyPatch(new, patch) |
| 37 | if err != nil { |
| 38 | t.Fatalf("ApplyPatch error: %v", err) |
| 39 | } |
| 40 | if result != old { |
| 41 | t.Errorf("expected %q, got %q", old, result) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | func TestEmptyPatch(t *testing.T) { |
| 46 | content := "Hello world" |
nothing calls this directly
no test coverage detected