From 349099fcf648a4d0c2df1002613b99c4ba0de838 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Thu, 19 May 2016 22:45:42 +0800 Subject: [PATCH] test gorush version. Signed-off-by: Bo-Yi Wu --- gorush/server_test.go | 4 ++++ gorush/version.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/gorush/server_test.go b/gorush/server_test.go index 4255201..45c36f0 100644 --- a/gorush/server_test.go +++ b/gorush/server_test.go @@ -21,7 +21,11 @@ func initTest() { } func TestPrintGoRushVersion(t *testing.T) { + SetVersion("3.0.0") + ver := GetVersion() PrintGoRushVersion() + + assert.Equal(t, "3.0.0", ver) } func TestRunNormalServer(t *testing.T) { diff --git a/gorush/version.go b/gorush/version.go index cd177c6..b7dbd08 100644 --- a/gorush/version.go +++ b/gorush/version.go @@ -12,6 +12,10 @@ func SetVersion(ver string) { version = ver } +func GetVersion() string { + return version +} + // PrintGoRushVersion provide print server engine func PrintGoRushVersion() { fmt.Printf(`GoRush %s, Compiler: %s %s, Copyright (C) 2016 Bo-Yi Wu, Inc.`,