Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 

36 рядки
1.1 KiB

  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. package version
  15. import "testing"
  16. func TestGoVer(t *testing.T) {
  17. for _, tst := range []struct {
  18. in, want string
  19. }{
  20. {"go1.8", "1.8.0"},
  21. {"go1.7.3", "1.7.3"},
  22. {"go1.8.typealias", "1.8.0-typealias"},
  23. {"go1.8beta1", "1.8.0-beta1"},
  24. {"go1.8rc2", "1.8.0-rc2"},
  25. {"devel +824f981dd4b7 Tue Apr 29 21:41:54 2014 -0400", "824f981dd4b7"},
  26. {"foo bar zipzap", ""},
  27. } {
  28. if got := goVer(tst.in); got != tst.want {
  29. t.Errorf("goVer(%q) = %q, want %q", tst.in, got, tst.want)
  30. }
  31. }
  32. }