GROOVY-7563: InvokerHelper: Print ranges in their code form in toString

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

Branch: refs/heads/master
Commit: 42427df55a535a559419b157ea7a02f5da8a46c5
Parents: 46e4d32
Author: Thibault Kruse <thibault.kr...@gmx.de>
Authored: Wed Sep 2 10:54:16 2015 +0200
Committer: paulk <pa...@asert.com.au>
Committed: Fri Jul 29 08:36:39 2016 +1000

----------------------------------------------------------------------
 src/main/org/codehaus/groovy/runtime/InvokerHelper.java         | 5 -----
 .../codehaus/groovy/runtime/InvokerHelperFormattingTest.groovy  | 5 ++---
 2 files changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/42427df5/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/InvokerHelper.java 
b/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
index 84924be..b27f0fb 100644
--- a/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
+++ b/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
@@ -124,11 +124,6 @@ public class InvokerHelper {
     }
 
     public static String toString(Object arguments) {
-        if (arguments instanceof Range) {
-            // for historic reasons, toString() formats Ranges by printing
-            // them as a list, whereas format prints them in .. notation
-            return toListString((Collection) arguments);
-        }
         return format(arguments, false);
     }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/42427df5/src/test/org/codehaus/groovy/runtime/InvokerHelperFormattingTest.groovy
----------------------------------------------------------------------
diff --git 
a/src/test/org/codehaus/groovy/runtime/InvokerHelperFormattingTest.groovy 
b/src/test/org/codehaus/groovy/runtime/InvokerHelperFormattingTest.groovy
index f28d226..7c70159 100644
--- a/src/test/org/codehaus/groovy/runtime/InvokerHelperFormattingTest.groovy
+++ b/src/test/org/codehaus/groovy/runtime/InvokerHelperFormattingTest.groovy
@@ -127,9 +127,8 @@ class InvokerHelperFormattingTest extends GroovyTestCase {
     }
 
     public void testToStringRanges() {
-        assert '[1, 2, 3, 4]' == InvokerHelper.toString(1..4)
-        assert "[a'b, a'c, a'd]" == InvokerHelper.toString('a\'b'..'a\'d')
-        // within other lists, ranges get ToStringed in code form
+        assert '1..4' == InvokerHelper.toString(1..4)
+        assert "a'b..a'd" == InvokerHelper.toString('a\'b'..'a\'d')
         assert "[1..4]" == InvokerHelper.toString([1..4])
         assert "[a'b..a'd]" == InvokerHelper.toString(['a\'b'..'a\'d'])
     }

Reply via email to