github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/release/version/version_test.go (about) 1 // Copyright 2015 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package version 5 6 import ( 7 "testing" 8 "time" 9 ) 10 11 func TestParse(t *testing.T) { 12 input := "Keybase-1.0.14-20160312013917+cd6f696.zip" 13 version, versionShort, versionTime, commit, err := Parse(input) 14 if err != nil { 15 t.Fatal(err) 16 } 17 if version != "1.0.14-20160312013917+cd6f696" { 18 t.Errorf("Failed to parse version properly: %s", version) 19 } 20 if versionShort != "1.0.14" { 21 t.Errorf("Failed to parse version properly: %s", versionShort) 22 } 23 timeCheck, _ := time.Parse("20060102150405", "20160312013917") 24 if versionTime != timeCheck { 25 t.Errorf("Failed to parse time properly: %s", timeCheck) 26 } 27 if commit != "cd6f696" { 28 t.Errorf("Failed to parse commit properly: %s", commit) 29 } 30 }