github.com/secure-build/gitlab-runner@v12.5.0+incompatible/helpers/shorten_token_test.go (about)

     1  package helpers
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestShortenToken(t *testing.T) {
     8  	var tests = []struct {
     9  		in  string
    10  		out string
    11  	}{
    12  		{"short", "short"},
    13  		{"veryverylongtoken", "veryvery"},
    14  	}
    15  
    16  	for _, test := range tests {
    17  		actual := ShortenToken(test.in)
    18  		if actual != test.out {
    19  			t.Error("Expected ", test.out, ", get ", actual)
    20  		}
    21  	}
    22  }