-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #266 from mum4k/release-0-13
Releasing Termdash v0.13.
- Loading branch information
Showing
34 changed files
with
783 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package faketerm | ||
|
||
import ( | ||
"image" | ||
"testing" | ||
|
||
"github.com/mum4k/termdash/cell" | ||
) | ||
|
||
func TestDiff(t *testing.T) { | ||
tests := []struct { | ||
desc string | ||
term1 *Terminal | ||
term2 *Terminal | ||
wantDiff bool | ||
}{ | ||
{ | ||
desc: "no diff on equal terminals", | ||
term1: func() *Terminal { | ||
t := MustNew(image.Point{2, 2}) | ||
t.SetCell(image.Point{0, 0}, 'a') | ||
return t | ||
}(), | ||
term2: func() *Terminal { | ||
t := MustNew(image.Point{2, 2}) | ||
t.SetCell(image.Point{0, 0}, 'a') | ||
return t | ||
}(), | ||
wantDiff: false, | ||
}, | ||
{ | ||
desc: "reports diff on when cell runes differ", | ||
term1: func() *Terminal { | ||
t := MustNew(image.Point{2, 2}) | ||
t.SetCell(image.Point{0, 0}, 'a') | ||
return t | ||
}(), | ||
term2: func() *Terminal { | ||
t := MustNew(image.Point{2, 2}) | ||
t.SetCell(image.Point{1, 1}, 'a') | ||
return t | ||
}(), | ||
wantDiff: true, | ||
}, | ||
{ | ||
desc: "reports diff on when cell options differ", | ||
term1: func() *Terminal { | ||
t := MustNew(image.Point{2, 2}) | ||
t.SetCell(image.Point{0, 0}, 'a', cell.Bold()) | ||
return t | ||
}(), | ||
term2: func() *Terminal { | ||
t := MustNew(image.Point{2, 2}) | ||
t.SetCell(image.Point{0, 0}, 'a') | ||
return t | ||
}(), | ||
wantDiff: true, | ||
}, | ||
} | ||
|
||
for _, tc := range tests { | ||
t.Run(tc.desc, func(t *testing.T) { | ||
gotDiff := Diff(tc.term1, tc.term2) | ||
if (gotDiff != "") != tc.wantDiff { | ||
t.Errorf("Diff -> unexpected diff while wantDiff:%v, the diff:\n%s", tc.wantDiff, gotDiff) | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.