MCPcopy Create free account
hub / github.com/beeker1121/goque / TestStackEmpty

Function TestStackEmpty

stack_test.go:548–570  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

546}
547
548func TestStackEmpty(t *testing.T) {
549 file := fmt.Sprintf("test_db_%d", time.Now().UnixNano())
550 s, err := OpenStack(file)
551 if err != nil {
552 t.Error(err)
553 }
554 defer s.Drop()
555
556 _, err = s.PushString("value for item")
557 if err != nil {
558 t.Error(err)
559 }
560
561 _, err = s.Pop()
562 if err != nil {
563 t.Error(err)
564 }
565
566 _, err = s.Pop()
567 if err != ErrEmpty {
568 t.Errorf("Expected to get empty error, got %s", err.Error())
569 }
570}
571
572func TestStackOutOfBounds(t *testing.T) {
573 file := fmt.Sprintf("test_db_%d", time.Now().UnixNano())

Callers

nothing calls this directly

Calls 4

OpenStackFunction · 0.85
PushStringMethod · 0.80
PopMethod · 0.80
DropMethod · 0.45

Tested by

no test coverage detected