github.com/balzaczyy/golucene@v0.0.0-20151210033525-d0be9ee89713/core/index/segmentInfos_test.go (about)

     1  package index
     2  
     3  import (
     4  	"github.com/balzaczyy/golucene/core/store"
     5  	"testing"
     6  )
     7  
     8  func TestLastCommitGeneration(t *testing.T) {
     9  	d, err := store.OpenFSDirectory("../search/testdata/belfrysample")
    10  	if err != nil {
    11  		t.Error(err)
    12  	}
    13  
    14  	files, err := d.ListAll()
    15  	if err != nil {
    16  		t.Error(err)
    17  	}
    18  	if files != nil {
    19  		genA := LastCommitGeneration(files)
    20  		assertEquals(t, int64(1), genA)
    21  	}
    22  }
    23  
    24  func assertEquals(t *testing.T, a, b interface{}) {
    25  	if a != b {
    26  		t.Errorf("Expected '%v', but '%v'", a, b)
    27  	}
    28  }