diff --git a/lang/funcs/core/core_test.go b/lang/funcs/core/core_test.go index 9f482b25..43067304 100644 --- a/lang/funcs/core/core_test.go +++ b/lang/funcs/core/core_test.go @@ -143,29 +143,31 @@ func TestPureFuncExec0(t *testing.T) { return } - if !reflect.DeepEqual(result, expect) { - // double check because DeepEqual is different since the func exists - diff := pretty.Compare(result, expect) - if diff != "" { // bonus - t.Errorf("test #%d: result did not match expected", index) - // TODO: consider making our own recursive print function - t.Logf("test #%d: actual: \n\n%s\n", index, spew.Sdump(result)) - t.Logf("test #%d: expected: \n\n%s", index, spew.Sdump(expect)) - - // more details, for tricky cases: - diffable := &pretty.Config{ - Diffable: true, - IncludeUnexported: true, - //PrintStringers: false, - //PrintTextMarshalers: false, - //SkipZeroFields: false, - } - t.Logf("test #%d: actual: \n\n%s\n", index, diffable.Sprint(result)) - t.Logf("test #%d: expected: \n\n%s", index, diffable.Sprint(expect)) - t.Logf("test #%d: diff:\n%s", index, diff) - return - } + if reflect.DeepEqual(result, expect) { + return } + + // double check because DeepEqual is different since the func exists + diff := pretty.Compare(result, expect) + if diff == "" { // bonus + return + } + t.Errorf("test #%d: result did not match expected", index) + // TODO: consider making our own recursive print function + t.Logf("test #%d: actual: \n\n%s\n", index, spew.Sdump(result)) + t.Logf("test #%d: expected: \n\n%s", index, spew.Sdump(expect)) + + // more details, for tricky cases: + diffable := &pretty.Config{ + Diffable: true, + IncludeUnexported: true, + //PrintStringers: false, + //PrintTextMarshalers: false, + //SkipZeroFields: false, + } + t.Logf("test #%d: actual: \n\n%s\n", index, diffable.Sprint(result)) + t.Logf("test #%d: expected: \n\n%s", index, diffable.Sprint(expect)) + t.Logf("test #%d: diff:\n%s", index, diff) }) } } diff --git a/lang/interfaces/metadata_test.go b/lang/interfaces/metadata_test.go index 6c0c5da9..ff2a8dc4 100644 --- a/lang/interfaces/metadata_test.go +++ b/lang/interfaces/metadata_test.go @@ -145,31 +145,33 @@ func TestMetadataParse0(t *testing.T) { return } - if metadata != nil { - if !reflect.DeepEqual(meta, metadata) { - // double check because DeepEqual is different since the func exists - diff := pretty.Compare(meta, metadata) - if diff != "" { // bonus - t.Errorf("test #%d: metadata did not match expected", index) - // TODO: consider making our own recursive print function - t.Logf("test #%d: actual: \n\n%s\n", index, spew.Sdump(meta)) - t.Logf("test #%d: expected: \n\n%s", index, spew.Sdump(metadata)) - - // more details, for tricky cases: - diffable := &pretty.Config{ - Diffable: true, - IncludeUnexported: true, - //PrintStringers: false, - //PrintTextMarshalers: false, - //SkipZeroFields: false, - } - t.Logf("test #%d: actual: \n\n%s\n", index, diffable.Sprint(meta)) - t.Logf("test #%d: expected: \n\n%s", index, diffable.Sprint(metadata)) - t.Logf("test #%d: diff:\n%s", index, diff) - return - } - } + if metadata == nil { + return } + if reflect.DeepEqual(meta, metadata) { + return + } + // double check because DeepEqual is different since the func exists + diff := pretty.Compare(meta, metadata) + if diff == "" { // bonus + return + } + t.Errorf("test #%d: metadata did not match expected", index) + // TODO: consider making our own recursive print function + t.Logf("test #%d: actual: \n\n%s\n", index, spew.Sdump(meta)) + t.Logf("test #%d: expected: \n\n%s", index, spew.Sdump(metadata)) + + // more details, for tricky cases: + diffable := &pretty.Config{ + Diffable: true, + IncludeUnexported: true, + //PrintStringers: false, + //PrintTextMarshalers: false, + //SkipZeroFields: false, + } + t.Logf("test #%d: actual: \n\n%s\n", index, diffable.Sprint(meta)) + t.Logf("test #%d: expected: \n\n%s", index, diffable.Sprint(metadata)) + t.Logf("test #%d: diff:\n%s", index, diff) }) } } diff --git a/lang/interpolate_test.go b/lang/interpolate_test.go index b0b88b80..4a3398fe 100644 --- a/lang/interpolate_test.go +++ b/lang/interpolate_test.go @@ -185,18 +185,19 @@ func TestInterpolate0(t *testing.T) { } } - if !reflect.DeepEqual(iast, exp) { - // double check because DeepEqual is different since the logf exists - diff := pretty.Compare(iast, exp) - if diff != "" { // bonus - t.Errorf("test #%d: AST did not match expected", index) - // TODO: consider making our own recursive print function - t.Logf("test #%d: actual: \n%s", index, spew.Sdump(iast)) - t.Logf("test #%d: expected: \n%s", index, spew.Sdump(exp)) - t.Logf("test #%d: diff:\n%s", index, diff) - return - } + if reflect.DeepEqual(iast, exp) { + return } + // double check because DeepEqual is different since the logf exists + diff := pretty.Compare(iast, exp) + if diff == "" { // bonus + return + } + t.Errorf("test #%d: AST did not match expected", index) + // TODO: consider making our own recursive print function + t.Logf("test #%d: actual: \n%s", index, spew.Sdump(iast)) + t.Logf("test #%d: expected: \n%s", index, spew.Sdump(exp)) + t.Logf("test #%d: diff:\n%s", index, diff) }) } } @@ -421,18 +422,19 @@ func TestInterpolateBasicStmt(t *testing.T) { } } - if !reflect.DeepEqual(iast, exp) { - // double check because DeepEqual is different since the logf exists - diff := pretty.Compare(iast, exp) - if diff != "" { // bonus - t.Errorf("test #%d: AST did not match expected", index) - // TODO: consider making our own recursive print function - t.Logf("test #%d: actual: \n%s", index, spew.Sdump(iast)) - t.Logf("test #%d: expected: \n%s", index, spew.Sdump(exp)) - t.Logf("test #%d: diff:\n%s", index, diff) - return - } + if reflect.DeepEqual(iast, exp) { + return } + // double check because DeepEqual is different since the logf exists + diff := pretty.Compare(iast, exp) + if diff == "" { // bonus + return + } + t.Errorf("test #%d: AST did not match expected", index) + // TODO: consider making our own recursive print function + t.Logf("test #%d: actual: \n%s", index, spew.Sdump(iast)) + t.Logf("test #%d: expected: \n%s", index, spew.Sdump(exp)) + t.Logf("test #%d: diff:\n%s", index, diff) }) } } @@ -742,18 +744,19 @@ func TestInterpolateBasicExpr(t *testing.T) { } } - if !reflect.DeepEqual(iast, exp) { - // double check because DeepEqual is different since the logf exists - diff := pretty.Compare(iast, exp) - if diff != "" { // bonus - t.Errorf("test #%d: AST did not match expected", index) - // TODO: consider making our own recursive print function - t.Logf("test #%d: actual: \n%s", index, spew.Sdump(iast)) - t.Logf("test #%d: expected: \n%s", index, spew.Sdump(exp)) - t.Logf("test #%d: diff:\n%s", index, diff) - return - } + if reflect.DeepEqual(iast, exp) { + return } + // double check because DeepEqual is different since the logf exists + diff := pretty.Compare(iast, exp) + if diff == "" { // bonus + return + } + t.Errorf("test #%d: AST did not match expected", index) + // TODO: consider making our own recursive print function + t.Logf("test #%d: actual: \n%s", index, spew.Sdump(iast)) + t.Logf("test #%d: expected: \n%s", index, spew.Sdump(exp)) + t.Logf("test #%d: diff:\n%s", index, diff) }) } } diff --git a/lang/lexparse_test.go b/lang/lexparse_test.go index 0ab41f08..1adaa511 100644 --- a/lang/lexparse_test.go +++ b/lang/lexparse_test.go @@ -2108,32 +2108,34 @@ func TestLexParse0(t *testing.T) { return } - if exp != nil { - if !reflect.DeepEqual(ast, exp) { - // double check because DeepEqual is different since the func exists - - // more details, for tricky cases: - diffable := &pretty.Config{ - Diffable: true, - IncludeUnexported: false, - //PrintStringers: false, // always false! - //PrintTextMarshalers: false, - SkipZeroFields: true, - } - diff := diffable.Compare(exp, ast) - if diff != "" { // bonus - t.Errorf("test #%d: AST did not match expected", index) - // TODO: consider making our own recursive print function - t.Logf("test #%d: actual: \n\n%s\n", index, spew.Sdump(ast)) - t.Logf("test #%d: expected: \n\n%s", index, spew.Sdump(exp)) - - t.Logf("test #%d: actual: \n\n%s\n", index, diffable.Sprint(ast)) - t.Logf("test #%d: expected: \n\n%s", index, diffable.Sprint(exp)) - t.Logf("test #%d: diff:\n%s", index, diff) - return - } - } + if exp == nil { + return } + if reflect.DeepEqual(ast, exp) { + return + } + // double check because DeepEqual is different since the func exists + + // more details, for tricky cases: + diffable := &pretty.Config{ + Diffable: true, + IncludeUnexported: false, + //PrintStringers: false, // always false! + //PrintTextMarshalers: false, + SkipZeroFields: true, + } + diff := diffable.Compare(exp, ast) + if diff == "" { // bonus + return + } + t.Errorf("test #%d: AST did not match expected", index) + // TODO: consider making our own recursive print function + t.Logf("test #%d: actual: \n\n%s\n", index, spew.Sdump(ast)) + t.Logf("test #%d: expected: \n\n%s", index, spew.Sdump(exp)) + + t.Logf("test #%d: actual: \n\n%s\n", index, diffable.Sprint(ast)) + t.Logf("test #%d: expected: \n\n%s", index, diffable.Sprint(exp)) + t.Logf("test #%d: diff:\n%s", index, diff) }) } }