- commit
- 22c4df36d9d944f924284e8948f18dde3a0e0eee
- parent
- 3a646347272b879a989447e3035eb91f69c28f42
- author
- Dami <dami.etoile@gmail.com>
- kind
- test risk score 0.0 of 3, Jev's estimate
| M | internal/ | 25 | +++++++++++++++++++++++++ |
@@ -153,3 +153,28 @@ func TestMergeBroken(t *testing.T) {
153153 t.Error("a merge naming a sheet removed")154154 }155155 }156+157+func TestMergeOneSheetFiles(t *testing.T) {158+ base := []byte(`{"version": 3, "names": {"Sales": "A1:A2"}, "cells": {"A1": "1", "A2": "2"}}`)159+ ours := []byte(`{"version": 3, "names": {"Sales": "A1:A3"}, "cells": {"A1": "1", "A2": "2", "A3": "3"}}`)160+ theirs := []byte(`{"version": 3, "names": {"Sales": "A1:A2", "Cost": "B1"}, "widths": {"B": 14}, "cells": {"A1": "1", "A2": "2", "B1": "=SUM(Sales)"}}`)161+ out, conflicts, err := Merge(base, ours, theirs)162+ if err != nil || len(conflicts) > 0 {163+ t.Fatal(err, conflicts)164+ }165+ want := `{166+ "version": 3,167+ "widths": {"B": 14},168+ "names": {"Cost": "B1", "Sales": "A1:A3"},169+ "cells": {170+ "A1": "1",171+ "B1": "=SUM(Sales)",172+ "A2": "2",173+ "A3": "3"174+ }175+}176+`177+ if string(out) != want {178+ t.Errorf("got\n%s\nwant\n%s", out, want)179+ }180+}