...

Source file src/cloud.google.com/go/internal/version/version_test.go

Documentation: cloud.google.com/go/internal/version

     1  // Copyright 2016 Google LLC
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package version
    16  
    17  import "testing"
    18  
    19  func TestGoVer(t *testing.T) {
    20  	for _, tst := range []struct {
    21  		in, want string
    22  	}{
    23  		{"go1.8", "1.8.0"},
    24  		{"go1.7.3", "1.7.3"},
    25  		{"go1.8.typealias", "1.8.0-typealias"},
    26  		{"go1.8beta1", "1.8.0-beta1"},
    27  		{"go1.8rc2", "1.8.0-rc2"},
    28  		{"devel +824f981dd4b7 Tue Apr 29 21:41:54 2014 -0400", "824f981dd4b7"},
    29  		{"foo bar zipzap", ""},
    30  	} {
    31  		if got := goVer(tst.in); got != tst.want {
    32  			t.Errorf("goVer(%q) = %q, want %q", tst.in, got, tst.want)
    33  		}
    34  	}
    35  }
    36  

View as plain text