From 431027edada3dc166f62cee768a27bdf62f2662d Mon Sep 17 00:00:00 2001 From: Leon Zhang Date: Wed, 26 Dec 2018 17:46:31 +0800 Subject: [PATCH] for test coverage --- VERSION | 2 +- cmd/soar/soar_test.go | 11 +++++++++-- common/meta_test.go | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index ac39a10..78bc1ab 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.9.0 +0.10.0 diff --git a/cmd/soar/soar_test.go b/cmd/soar/soar_test.go index 5136a2a..f8aa494 100644 --- a/cmd/soar/soar_test.go +++ b/cmd/soar/soar_test.go @@ -19,6 +19,7 @@ package main import ( "flag" "fmt" + "os" "testing" "github.com/XiaoMi/soar/common" @@ -88,8 +89,14 @@ func Test_Main_initQuery(t *testing.T) { // read from file initQuery(common.DevPath + "/README.md") - // TODO: read from stdin - // initQuery("") + orgStdin := os.Stdin + tmpStdin, err := os.Open(common.DevPath + "/VERSION") + if err != nil { + t.Error(err) + } + os.Stdin = tmpStdin + fmt.Println(initQuery("")) + os.Stdin = orgStdin common.Log.Debug("Exiting function: %s", common.GetFunctionName()) } diff --git a/common/meta_test.go b/common/meta_test.go index d64e3c6..d5264d9 100644 --- a/common/meta_test.go +++ b/common/meta_test.go @@ -160,7 +160,7 @@ func TestStringStorageReq(t *testing.T) { "char(-1)", } err := GoldenDiff(func() { - for name, _ := range CharSets { + for name := range CharSets { for _, tp := range dataTypes { fmt.Println(tp, name, StringStorageReq(tp, name)) } -- GitLab