github.com/vchain-us/vcn@v0.9.11-0.20210921212052-a2484d23c0b3/pkg/extractor/file/version_test.go (about)

     1  /*
     2   * Copyright (c) 2018-2020 vChain, Inc. All Rights Reserved.
     3   * This software is released under GPL3.
     4   * The full license information can be found under:
     5   * https://www.gnu.org/licenses/gpl-3.0.en.html
     6   *
     7   */
     8  
     9  package file
    10  
    11  import (
    12  	"testing"
    13  
    14  	"github.com/stretchr/testify/assert"
    15  )
    16  
    17  func TestInferVer(t *testing.T) {
    18  	testCases := map[string]string{
    19  		// Supported
    20  		"vcn-v0.4.0-darwin-10.6-amd64":     "0.4.0",
    21  		"vcn-v0.4.0-linux-amd64":           "0.4.0",
    22  		"vcn-v0.4.0-windows-4.0-amd64.exe": "0.4.0",
    23  
    24  		// Unsupported
    25  		"codenotary_vcn_0.4.0_setup.exe": "",
    26  	}
    27  
    28  	for filename, ver := range testCases {
    29  		assert.Equal(t, ver, inferVer(filename), "wrong version for %s", filename)
    30  	}
    31  
    32  }