From af2a66b2263425461fc955fe9cb3726a0693caef Mon Sep 17 00:00:00 2001 From: Tzu-Jung Lee Date: Mon, 16 Jan 2017 23:23:06 -0800 Subject: [PATCH] test_app: unexport internal function. This reverts commit 24c9b2761d7da5ab5084310f0cb3e51c7fc9738d. --- tests/test_app/app.go | 16 +++++++--------- tests/test_app/main.go | 30 +++++++++++++++--------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/tests/test_app/app.go b/tests/test_app/app.go index 8651cd4ba..87b74ead0 100644 --- a/tests/test_app/app.go +++ b/tests/test_app/app.go @@ -2,18 +2,16 @@ package main import ( "bytes" + "fmt" "os" "time" "github.com/tendermint/abci/client" "github.com/tendermint/abci/types" - common "github.com/tendermint/go-common" "github.com/tendermint/go-process" ) -//---------------------------------------- - -func StartApp(abciApp string) *process.Process { +func startApp(abciApp string) *process.Process { // Start the app //outBuf := NewBufferCloser(nil) proc, err := process.StartProcess("abci_app", @@ -33,7 +31,7 @@ func StartApp(abciApp string) *process.Process { return proc } -func StartClient(abciType string) abcicli.Client { +func startClient(abciType string) abcicli.Client { // Start client client, err := abcicli.NewClient("tcp://127.0.0.1:46658", abciType, true) if err != nil { @@ -42,7 +40,7 @@ func StartClient(abciType string) abcicli.Client { return client } -func SetOption(client abcicli.Client, key, value string) { +func setOption(client abcicli.Client, key, value string) { res := client.SetOptionSync(key, value) _, _, log := res.Code, res.Data, res.Log if res.IsErr() { @@ -50,7 +48,7 @@ func SetOption(client abcicli.Client, key, value string) { } } -func Commit(client abcicli.Client, hashExp []byte) { +func commit(client abcicli.Client, hashExp []byte) { res := client.CommitSync() _, data, log := res.Code, res.Data, res.Log if res.IsErr() { @@ -62,7 +60,7 @@ func Commit(client abcicli.Client, hashExp []byte) { } } -func DeliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) { +func deliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) { res := client.DeliverTxSync(txBytes) code, data, log := res.Code, res.Data, res.Log if code != codeExp { @@ -75,7 +73,7 @@ func DeliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, da } } -func CheckTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) { +func checkTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) { res := client.CheckTxSync(txBytes) code, data, log := res.Code, res.Data, res.Log if res.IsErr() { diff --git a/tests/test_app/main.go b/tests/test_app/main.go index 05f66b07f..376c02fe5 100644 --- a/tests/test_app/main.go +++ b/tests/test_app/main.go @@ -27,22 +27,22 @@ func testCounter() { } fmt.Printf("Running %s test with abci=%s\n", abciApp, abciType) - appProc := StartApp(abciApp) + appProc := startApp(abciApp) defer appProc.StopProcess(true) - client := StartClient(abciType) + client := startClient(abciType) defer client.Stop() - SetOption(client, "serial", "on") - Commit(client, nil) - DeliverTx(client, []byte("abc"), types.CodeType_BadNonce, nil) - Commit(client, nil) - DeliverTx(client, []byte{0x00}, types.CodeType_OK, nil) - Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 1}) - DeliverTx(client, []byte{0x00}, types.CodeType_BadNonce, nil) - DeliverTx(client, []byte{0x01}, types.CodeType_OK, nil) - DeliverTx(client, []byte{0x00, 0x02}, types.CodeType_OK, nil) - DeliverTx(client, []byte{0x00, 0x03}, types.CodeType_OK, nil) - DeliverTx(client, []byte{0x00, 0x00, 0x04}, types.CodeType_OK, nil) - DeliverTx(client, []byte{0x00, 0x00, 0x06}, types.CodeType_BadNonce, nil) - Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5}) + setOption(client, "serial", "on") + commit(client, nil) + deliverTx(client, []byte("abc"), types.CodeType_BadNonce, nil) + commit(client, nil) + deliverTx(client, []byte{0x00}, types.CodeType_OK, nil) + commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 1}) + deliverTx(client, []byte{0x00}, types.CodeType_BadNonce, nil) + deliverTx(client, []byte{0x01}, types.CodeType_OK, nil) + deliverTx(client, []byte{0x00, 0x02}, types.CodeType_OK, nil) + deliverTx(client, []byte{0x00, 0x03}, types.CodeType_OK, nil) + deliverTx(client, []byte{0x00, 0x00, 0x04}, types.CodeType_OK, nil) + deliverTx(client, []byte{0x00, 0x00, 0x06}, types.CodeType_BadNonce, nil) + commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5}) }