mirror of
https://github.com/maaslalani/gambit.git
synced 2025-01-14 02:23:04 +02:00
border_test
This commit is contained in:
parent
d997be5af2
commit
2cb018acb0
@ -29,7 +29,6 @@ func Cell(x, y int) string {
|
||||
col := (x - marginLeft) / cellWidth
|
||||
row := board.LastRow - (y-marginTop)/cellHeight
|
||||
return position.ToSquare(row, col)
|
||||
|
||||
}
|
||||
|
||||
// withMarginLeft returns a string with a prepended left margin
|
||||
|
39
border/border_test.go
Normal file
39
border/border_test.go
Normal file
@ -0,0 +1,39 @@
|
||||
package border_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/maaslalani/gambit/border"
|
||||
)
|
||||
|
||||
func TestTopBorder(t *testing.T) {
|
||||
tests := []struct {
|
||||
borderFunc func() string
|
||||
want string
|
||||
}{
|
||||
|
||||
{
|
||||
border.Top,
|
||||
" ┌───┬───┬───┬───┬───┬───┬───┬───┐\n",
|
||||
},
|
||||
{
|
||||
border.Middle,
|
||||
" ├───┼───┼───┼───┼───┼───┼───┼───┤\n",
|
||||
},
|
||||
{
|
||||
border.Bottom,
|
||||
" └───┴───┴───┴───┴───┴───┴───┴───┘\n",
|
||||
},
|
||||
{
|
||||
border.BottomLabels,
|
||||
" A B C D E F G H\n",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
got := test.borderFunc()
|
||||
if got != test.want {
|
||||
t.Errorf("want %s, got %s", test.want, got)
|
||||
}
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ func fg(color string) colorFunc {
|
||||
return NewStyle().Foreground(Color(color)).Render
|
||||
}
|
||||
|
||||
var Magenta = fg("5")
|
||||
var Faint = fg("8")
|
||||
var Red = fg("1")
|
||||
var Cyan = fg("6")
|
||||
var Faint = fg("8")
|
||||
var Magenta = fg("5")
|
||||
var Red = fg("1")
|
||||
|
Loading…
Reference in New Issue
Block a user