Skip to content

Commit

Permalink
chore: add stack tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Musat committed Dec 12, 2022
1 parent 08ecce3 commit c950380
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions internal/graphics/stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,37 @@ func TestCellStack_Render_lines(t *testing.T) {
}))
a.Equal("╷", cs.Render())
}

func TestCellStack_Render_charHasPriority(t *testing.T) {
a := require.New(t)
cs := CellStack{}
cs.add(LinesCell(Lines{
t: true,
}))
cs.PlaceChar('a')
a.Equal("a", cs.Render())
}

func TestCellStack_Render_arrowHasPriority(t *testing.T) {
a := require.New(t)
cs := CellStack{}
cs.PlaceArrow(false)
cs.add(LinesCell(Lines{
t: true,
}))
a.Equal("▷", cs.Render())
}

func TestCellStack_Tag(t *testing.T) {
a := require.New(t)
cs := CellStack{}

a.Equal(false, cs.Is("key", "foo"))
cs.Tag("key", "bar")
a.Equal(false, cs.Is("key", "foo"))
a.Equal(true, cs.Is("key", "bar"))
cs.Tag("key", "foo")
cs.Tag("otherKey", "bar")
a.Equal(true, cs.Is("key", "foo"))
a.Equal(true, cs.Is("otherKey", "bar"))
}

0 comments on commit c950380

Please sign in to comment.