github.com/aaa256/atlantis@v0.0.0-20210707112435-42ee889287a2/metrics/writer_test.go (about)

     1  package metrics
     2  
     3  import (
     4  	"sort"
     5  	"testing"
     6  )
     7  
     8  func TestMetricsSorting(t *testing.T) {
     9  	var namedMetrics = namedMetricSlice{
    10  		{name: "zzz"},
    11  		{name: "bbb"},
    12  		{name: "fff"},
    13  		{name: "ggg"},
    14  	}
    15  
    16  	sort.Sort(namedMetrics)
    17  	for i, name := range []string{"bbb", "fff", "ggg", "zzz"} {
    18  		if namedMetrics[i].name != name {
    19  			t.Fail()
    20  		}
    21  	}
    22  }