groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject groovy git commit: GROOVY-7569: Use verbose formatting for PowerAsserts (closes #374)
Date Mon, 28 Aug 2017 10:47:29 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X f1fb1180e -> a2e635f9b


GROOVY-7569: Use verbose formatting for PowerAsserts (closes #374)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/a2e635f9
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/a2e635f9
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/a2e635f9

Branch: refs/heads/GROOVY_2_5_X
Commit: a2e635f9bd81aa712c284e1504aa418ad13a58b8
Parents: f1fb118
Author: Thibault Kruse <thibault.kruse@gmx.de>
Authored: Fri Jul 29 08:22:39 2016 +0200
Committer: paulk <paulk@asert.com.au>
Committed: Mon Aug 28 20:47:19 2017 +1000

----------------------------------------------------------------------
 .../groovy/runtime/powerassert/AssertionRenderer.java    |  3 ++-
 .../runtime/powerassert/AssertionRenderingTest.groovy    |  8 ++++----
 .../groovy/runtime/powerassert/ValueRenderingTest.groovy | 11 ++++-------
 3 files changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/a2e635f9/src/main/org/codehaus/groovy/runtime/powerassert/AssertionRenderer.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/powerassert/AssertionRenderer.java b/src/main/org/codehaus/groovy/runtime/powerassert/AssertionRenderer.java
index 8fa14cc..7a37e08 100644
--- a/src/main/org/codehaus/groovy/runtime/powerassert/AssertionRenderer.java
+++ b/src/main/org/codehaus/groovy/runtime/powerassert/AssertionRenderer.java
@@ -21,6 +21,7 @@ package org.codehaus.groovy.runtime.powerassert;
 import java.util.*;
 
 import org.codehaus.groovy.runtime.DefaultGroovyMethods;
+import org.codehaus.groovy.runtime.InvokerHelper;
 
 /**
  * Creates a string representation of an assertion and its recorded values.
@@ -151,7 +152,7 @@ public final class AssertionRenderer {
         String toString;
 
         try {
-            toString = DefaultGroovyMethods.toString(value);
+            toString = InvokerHelper.format(value, true, -1, false);
         } catch (Exception e) {
             return String.format("%s (toString() threw %s)",
                     javaLangObjectToString(value), e.getClass().getName());

http://git-wip-us.apache.org/repos/asf/groovy/blob/a2e635f9/src/test/org/codehaus/groovy/runtime/powerassert/AssertionRenderingTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/powerassert/AssertionRenderingTest.groovy
b/src/test/org/codehaus/groovy/runtime/powerassert/AssertionRenderingTest.groovy
index b812605..3e7e0e6 100644
--- a/src/test/org/codehaus/groovy/runtime/powerassert/AssertionRenderingTest.groovy
+++ b/src/test/org/codehaus/groovy/runtime/powerassert/AssertionRenderingTest.groovy
@@ -88,7 +88,7 @@ assert a.get(b) == null
         isRendered """
 assert [1]."\$x"(0) == null
            | |     |
-           1 get   false
+           1 'get' false
         """, {
             def x = "get"
             assert [1]."$x"(0) == null
@@ -378,7 +378,7 @@ assert holder.@x
 assert a.&"\$b" == null
        |    |  |
        []   |  false
-            get
+            'get'
         """, {
             def a = []
             def b = "get"
@@ -469,7 +469,7 @@ assert [1, *a] == null
         isRendered """
 assert one(*:m)
        |     |
-       0     [a:1, b:2]
+       0     ['a':1, 'b':2]
         """, {
             def m = [a:1, b:2]
             assert one(*:m)
@@ -479,7 +479,7 @@ assert one(*:m)
 assert [a:1, *:m] == null
                |  |
                |  false
-               [b:2, c:3]
+               ['b':2, 'c':3]
         """, {
             def m = [b:2, c:3]
             assert [a:1, *:m] == null

http://git-wip-us.apache.org/repos/asf/groovy/blob/a2e635f9/src/test/org/codehaus/groovy/runtime/powerassert/ValueRenderingTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/powerassert/ValueRenderingTest.groovy b/src/test/org/codehaus/groovy/runtime/powerassert/ValueRenderingTest.groovy
index 4ac582b..d44958b 100644
--- a/src/test/org/codehaus/groovy/runtime/powerassert/ValueRenderingTest.groovy
+++ b/src/test/org/codehaus/groovy/runtime/powerassert/ValueRenderingTest.groovy
@@ -54,7 +54,7 @@ assert x == null
 assert x == null
        | |
        | false
-       foo
+       'foo'
         """, {
             def x = "foo"
             assert x == null
@@ -65,10 +65,7 @@ assert x == null
         isRendered """
 assert null == x
             |  |
-            |  one
-            |  two
-            |  three
-            |  four
+            |  'one\\ntwo\\rthree\\r\\nfour'
             false
         """, {
             def x = "one\ntwo\rthree\r\nfour"
@@ -93,7 +90,7 @@ assert x == null
 assert x == null
        | |
        | false
-       [one, two]
+       ['one', 'two']
         """, {
             def x = ["one", "two"] as String[]
             assert x == null
@@ -107,7 +104,7 @@ assert x == null
 assert x == null
        | |
        | false
-       ""
+       ''
         ''', {
             assert x == null
         }


Mime
View raw message