This commit is contained in:
Łukasz Magiera 2020-08-04 19:07:31 +02:00
parent adee59c795
commit e4f475ee59
4 changed files with 20 additions and 21 deletions

View File

@ -4,7 +4,6 @@ import (
"context" "context"
"fmt" "fmt"
"os" "os"
"strings" "strings"
"testing" "testing"
@ -81,7 +80,7 @@ func pledgeSectors(t *testing.T, ctx context.Context, miner TestStorageNode, n,
s, err := miner.SectorsList(ctx) // Note - the test builder doesn't import genesis sectors into FSM s, err := miner.SectorsList(ctx) // Note - the test builder doesn't import genesis sectors into FSM
require.NoError(t, err) require.NoError(t, err)
fmt.Printf("Sectors: %d\n", len(s)) fmt.Printf("Sectors: %d\n", len(s))
if len(s) >= n + existing { if len(s) >= n+existing {
break break
} }

View File

@ -1038,17 +1038,17 @@ var clientListDeals = &cli.Command{
price := types.FIL(types.BigMul(d.LocalDeal.PricePerEpoch, types.NewInt(d.LocalDeal.Duration))) price := types.FIL(types.BigMul(d.LocalDeal.PricePerEpoch, types.NewInt(d.LocalDeal.Duration)))
w.Write(map[string]interface{}{ w.Write(map[string]interface{}{
"DealCid": propcid, "DealCid": propcid,
"DealId":d.LocalDeal.DealID, "DealId": d.LocalDeal.DealID,
"Provider":d.LocalDeal.Provider, "Provider": d.LocalDeal.Provider,
"State":dealStateString(color, d.LocalDeal.State), "State": dealStateString(color, d.LocalDeal.State),
"On Chain?":onChain, "On Chain?": onChain,
"Slashed?":slashed, "Slashed?": slashed,
"PieceCID":piece, "PieceCID": piece,
"Size":types.SizeStr(types.NewInt(d.LocalDeal.Size)), "Size": types.SizeStr(types.NewInt(d.LocalDeal.Size)),
"Price":price, "Price": price,
"Duration":d.LocalDeal.Duration, "Duration": d.LocalDeal.Duration,
"Message":d.LocalDeal.Message, "Message": d.LocalDeal.Message,
}) })
} }

View File

@ -10,22 +10,22 @@ import (
func TestTableWriter(t *testing.T) { func TestTableWriter(t *testing.T) {
tw := New(Col("C1"), Col("X"), Col("C333"), NewLineCol("Thing")) tw := New(Col("C1"), Col("X"), Col("C333"), NewLineCol("Thing"))
tw.Write(map[string]interface{}{ tw.Write(map[string]interface{}{
"C1": "234", "C1": "234",
"C333": "ou", "C333": "ou",
}) })
tw.Write(map[string]interface{}{ tw.Write(map[string]interface{}{
"C1": "23uieui4", "C1": "23uieui4",
"C333": "ou", "C333": "ou",
"X": color.GreenString("#"), "X": color.GreenString("#"),
"Thing": "a very long thing, annoyingly so", "Thing": "a very long thing, annoyingly so",
}) })
tw.Write(map[string]interface{}{ tw.Write(map[string]interface{}{
"C1": "ttttttttt", "C1": "ttttttttt",
"C333": "eui", "C333": "eui",
}) })
tw.Write(map[string]interface{}{ tw.Write(map[string]interface{}{
"C1": "1", "C1": "1",
"C333": "2", "C333": "2",
"SurpriseColumn": "42", "SurpriseColumn": "42",
}) })
if err := tw.Flush(os.Stdout); err != nil { if err := tw.Flush(os.Stdout); err != nil {

View File

@ -45,7 +45,7 @@ func (w *TableWriter) Write(r map[string]interface{}) {
// this can cause columns to be out of order, but will at least work // this can cause columns to be out of order, but will at least work
byColID := map[int]string{} byColID := map[int]string{}
cloop: cloop:
for col, val := range r { for col, val := range r {
for i, column := range w.cols { for i, column := range w.cols {
if column.Name == col { if column.Name == col {