(t *testing.T)
| 1014 | } |
| 1015 | |
| 1016 | func TestDiffPrettyHtml(t *testing.T) { |
| 1017 | type TestCase struct { |
| 1018 | Diffs []Diff |
| 1019 | |
| 1020 | Expected string |
| 1021 | } |
| 1022 | |
| 1023 | dmp := New() |
| 1024 | |
| 1025 | for i, tc := range []TestCase{ |
| 1026 | { |
| 1027 | Diffs: []Diff{ |
| 1028 | {DiffEqual, "a\n"}, |
| 1029 | {DiffDelete, "<B>b</B>"}, |
| 1030 | {DiffInsert, "c&d"}, |
| 1031 | }, |
| 1032 | |
| 1033 | Expected: "<span>a¶<br></span><del style=\"background:#ffe6e6;\"><B>b</B></del><ins style=\"background:#e6ffe6;\">c&d</ins>", |
| 1034 | }, |
| 1035 | } { |
| 1036 | actual := dmp.DiffPrettyHtml(tc.Diffs) |
| 1037 | assert.Equal(t, tc.Expected, actual, fmt.Sprintf("Test case #%d, %#v", i, tc)) |
| 1038 | } |
| 1039 | } |
| 1040 | |
| 1041 | func TestDiffPrettyText(t *testing.T) { |
| 1042 | type TestCase struct { |
nothing calls this directly
no test coverage detected