Example #1
0
func TestFileBookmarks(t *testing.T) {
	ut.Run(t)

	b, err := NewFileBookmarks("./bookmarks.json")
	ut.AssertNil(err)
	defer func() {
		err = os.Remove("./bookmarks.json")
	}()
	assertBookmarks(b)
}
Example #2
0
func TestMemoryHistory(t *testing.T) {
	ut.Run(t)
	stack := NewMemoryHistory()

	page1 := &State{}
	stack.Push(page1)
	ut.AssertEquals(1, stack.Len())
	ut.AssertEquals(page1, stack.Top())

	page2 := &State{}
	stack.Push(page2)
	ut.AssertEquals(2, stack.Len())
	ut.AssertEquals(page2, stack.Top())

	page := stack.Pop()
	ut.AssertEquals(page, page2)
	ut.AssertEquals(1, stack.Len())
	ut.AssertEquals(page1, stack.Top())

	page = stack.Pop()
	ut.AssertEquals(page, page1)
	ut.AssertEquals(0, stack.Len())
}
Example #3
0
func TestMemoryBookmarks(t *testing.T) {
	ut.Run(t)

	b := NewMemoryBookmarks()
	assertBookmarks(b)
}