iterator_test.go

最后更新于:2022-04-02 04:49:59

~~~ package iterator import ( "fmt" "testing" ) func TestIterator(t *testing.T) { bg := BookGroup{} nb := Book{"a"} bg.add(nb) nbb := Book{"b"} bg.add(nbb) it := bg.createIterator() for b := it.first(); b != nil; b = it.next() { fmt.Println(b) } } ~~~
';