Ignore some functions in the Go template when header is rendered

This fix ignore some functions in the Go template when header is
redendered, so that `--format "{{truncate .ID 1}}"` will still
be able to redener the header correctly.

Additional test cases have been added to the unit test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2017-02-03 20:23:00 -08:00
parent 9dda1155f3
commit 82bf90ffbc
4 changed files with 9 additions and 24 deletions

View File

@ -2,13 +2,8 @@ package formatter
import (
"bytes"
//"encoding/json"
//"strings"
"testing"
//"time"
//"github.com/docker/docker/api/types"
//"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/testutil/assert"
)
@ -44,10 +39,6 @@ VOLUME NAME LINKS SIZE
}
for _, testcase := range cases {
//networks := []types.NetworkResource{
// {ID: "networkID1", Name: "foobar_baz", Driver: "foo", Scope: "local", Created: timestamp1},
// {ID: "networkID2", Name: "foobar_bar", Driver: "bar", Scope: "local", Created: timestamp2},
//}
out := bytes.NewBufferString("")
testcase.context.Output = out
testcase.context.Write()