github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/courier/version_switch_test.go (about)

     1  package courier
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestParseVersionSwitch(t *testing.T) {
    10  	tt := assert.New(t)
    11  
    12  	{
    13  		others, v, exist := ParseVersionSwitch("aadfafdads@x-version(VERSION_A)")
    14  		tt.Equal("VERSION_A", v)
    15  		tt.Equal("aadfafdads", others)
    16  		tt.True(exist)
    17  	}
    18  
    19  	{
    20  		others, _, exist := ParseVersionSwitch("aadfafdads")
    21  		tt.Equal("aadfafdads", others)
    22  		tt.False(exist)
    23  	}
    24  }