-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package config | ||
|
||
var Version string = "dev" | ||
|
||
func GetUserAgent() string { | ||
return "fixctl-" + Version | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package config | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestVersion(t *testing.T) { | ||
originalVersion := Version | ||
|
||
newVersion := "v1.2.3" | ||
Version = newVersion | ||
if Version != newVersion { | ||
t.Errorf("Expected version %s, but got %s", newVersion, Version) | ||
} | ||
|
||
Version = originalVersion | ||
if Version != originalVersion { | ||
t.Errorf("Expected version %s, but got %s", originalVersion, Version) | ||
} | ||
} | ||
|
||
func TestGetUserAgent(t *testing.T) { | ||
originalVersion := Version | ||
|
||
expectedUserAgent := "fixctl-dev" | ||
if userAgent := GetUserAgent(); userAgent != expectedUserAgent { | ||
t.Errorf("Expected User-Agent %s, but got %s", expectedUserAgent, userAgent) | ||
} | ||
|
||
Version = "v1.2.3" | ||
expectedUserAgent = "fixctl-v1.2.3" | ||
if userAgent := GetUserAgent(); userAgent != expectedUserAgent { | ||
t.Errorf("Expected User-Agent %s, but got %s", expectedUserAgent, userAgent) | ||
} | ||
|
||
Version = originalVersion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters