github.com/puellanivis/breton@v0.2.16/lib/sync/edge/edge_test.go (about)

     1  package edge
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestEdge(t *testing.T) {
     8  	var g Edge
     9  
    10  	if !g.Up() {
    11  		t.Error("edge didn't trigger")
    12  	}
    13  
    14  	if g.Up() {
    15  		t.Error("edge triggered twice")
    16  	}
    17  
    18  	if !g.Down() {
    19  		t.Error("edge didn't trigger down")
    20  	}
    21  
    22  	if g.Down() {
    23  		t.Error("edge triggered down twice")
    24  	}
    25  
    26  	if !g.Up() {
    27  		t.Error("edge didn't retrigger after triggering down")
    28  	}
    29  }