1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix broken JSON support in cli/command/formatter

How to test:

    $ docker ps --format '{{json .}}'
    $ docker network ls --format '{{json .}}'
    $ docker volume ls --format '{{json .}}'

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2016-09-13 07:01:31 +00:00
parent a2ad359730
commit 3a32b58792
11 changed files with 334 additions and 7 deletions

View file

@ -4,6 +4,7 @@ package assert
import (
"fmt"
"path/filepath"
"reflect"
"runtime"
"strings"
)
@ -44,6 +45,14 @@ func NilError(t TestingT, err error) {
}
}
// DeepEqual compare the actual value to the expected value and fails the test if
// they are not "deeply equal".
func DeepEqual(t TestingT, actual, expected interface{}) {
if !reflect.DeepEqual(actual, expected) {
fatal(t, "Expected '%v' (%T) got '%v' (%T)", expected, expected, actual, actual)
}
}
// Error asserts that error is not nil, and contains the expected text,
// otherwise it fails the test.
func Error(t TestingT, err error, contains string) {