diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go index 2f3fc7e1fe..1b3dcee302 100644 --- a/consensus/ethash/ethash.go +++ b/consensus/ethash/ethash.go @@ -575,4 +575,4 @@ func (ethash *Ethash) APIs(chain consensus.ChainReader) []rpc.API { // dataset. func SeedHash(block uint64) []byte { return seedHash(block) -} \ No newline at end of file +} diff --git a/console/console.go b/console/console.go index e17614bcb0..d843044ffc 100644 --- a/console/console.go +++ b/console/console.go @@ -273,7 +273,7 @@ func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, str // console's available modules. func (c *Console) Welcome() { // Print some generic XDC metadata - fmt.Fprintf(c.printer, "Welcome to the XinFin JavaScript console!\n\n") + fmt.Fprintf(c.printer, "Welcome to the XDC JavaScript console!\n\n") c.jsre.Run(` console.log("instance: " + web3.version.node); console.log("coinbase: " + eth.coinbase); diff --git a/console/console_test.go b/console/console_test.go index 69d8f0c5c9..7b1629c032 100644 --- a/console/console_test.go +++ b/console/console_test.go @@ -19,6 +19,7 @@ package console import ( "bytes" "errors" + "fmt" "io/ioutil" "os" "strings" @@ -154,6 +155,33 @@ func (env *tester) Close(t *testing.T) { os.RemoveAll(env.workspace) } +// Tests that the node lists the correct welcome message, notably that it contains +// the instance name, coinbase account, block number, data directory and supported +// console modules. +func TestWelcome(t *testing.T) { + tester := newTester(t, nil) + defer tester.Close(t) + + tester.console.Welcome() + + output := tester.output.String() + if want := "Welcome"; !strings.Contains(output, want) { + t.Fatalf("console output missing welcome message: have\n%s\nwant also %s", output, want) + } + if want := fmt.Sprintf("instance: %s", testInstance); !strings.Contains(output, want) { + t.Fatalf("console output missing instance: have\n%s\nwant also %s", output, want) + } + if want := fmt.Sprintf("coinbase: %s", testAddress); !strings.Contains(output, want) { + t.Fatalf("console output missing coinbase: have\n%s\nwant also %s", output, want) + } + if want := "at block: 0"; !strings.Contains(output, want) { + t.Fatalf("console output missing sync status: have\n%s\nwant also %s", output, want) + } + if want := fmt.Sprintf("datadir: %s", tester.workspace); !strings.Contains(output, want) { + t.Fatalf("console output missing coinbase: have\n%s\nwant also %s", output, want) + } +} + // Tests that JavaScript statement evaluation works as intended. func TestEvaluate(t *testing.T) { tester := newTester(t, nil) @@ -308,4 +336,4 @@ func TestIndenting(t *testing.T) { t.Errorf("test %d: invalid indenting: have %d, want %d", i, counted, tt.expectedIndentCount) } } -} \ No newline at end of file +}