groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject groovy git commit: formatting and general tidy up of some tests
Date Tue, 04 Oct 2016 00:59:43 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 55c186f42 -> 94137c913


formatting and general tidy up of some tests


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

Branch: refs/heads/master
Commit: 94137c91379b8152afe7e76e59c6537dc5a12ef3
Parents: 55c186f
Author: paulk <paulk@asert.com.au>
Authored: Tue Oct 4 10:59:04 2016 +1000
Committer: paulk <paulk@asert.com.au>
Committed: Tue Oct 4 10:59:32 2016 +1000

----------------------------------------------------------------------
 gradle/pomconfigurer.gradle                     |  3 +++
 src/tck/test/gls/ch03/s01/Unicode1.groovy       | 11 +++-----
 src/tck/test/gls/ch03/s01/Unicode2.groovy       | 18 +++++--------
 .../gls/ch03/s02/LexicalTranslation1.groovy     |  4 +--
 src/tck/test/gls/ch03/s02/Longest1.groovy       |  2 --
 .../test/gls/ch03/s03/UnicodeEscapes1.groovy    |  5 +---
 .../test/gls/ch03/s03/UnicodeEscapes2.groovy    | 27 ++++++++++----------
 7 files changed, 30 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/gradle/pomconfigurer.gradle
----------------------------------------------------------------------
diff --git a/gradle/pomconfigurer.gradle b/gradle/pomconfigurer.gradle
index 3f08f4a..2877e8a 100644
--- a/gradle/pomconfigurer.gradle
+++ b/gradle/pomconfigurer.gradle
@@ -576,6 +576,9 @@ project.ext.pomConfigureClosureWithoutTweaks = {
             contributor {
                 name 'Santhosh Kumar T'
             }
+            contributor {
+                name 'Alan Green'
+            }
         }
         mailingLists {
             mailingList {

http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s01/Unicode1.groovy
----------------------------------------------------------------------
diff --git a/src/tck/test/gls/ch03/s01/Unicode1.groovy b/src/tck/test/gls/ch03/s01/Unicode1.groovy
index 45ab780..92984ab 100644
--- a/src/tck/test/gls/ch03/s01/Unicode1.groovy
+++ b/src/tck/test/gls/ch03/s01/Unicode1.groovy
@@ -17,17 +17,14 @@
  *  under the License.
  */
 package gls.ch03.s01;
+
 /**
  * Except for comments, identifiers and the contents of ... string 
  * literals, all input elements are formed from ASCII characters.
  *
  * TODO: Find a better way to test these things
  * Note that this is a little hard to test since the input file is ASCII.
- *
- * @author Alan Green
- * @author Jeremy Rayner
  */
-
 class Unicode1 extends GroovyTestCase {
     //TODO: find some way to assert that Unicode3.0 + is available
 
@@ -35,7 +32,7 @@ class Unicode1 extends GroovyTestCase {
       * This doc comment checks that Unicode is allowed in javadoc.
       * e.g. \u05D0\u2136\u05d3\u05d7
       */
-    public void testComments() {
+    void testComments() {
         // Unicode is allowed in comments
         // This is a comment \u0410\u0406\u0414\u0419
         /* Another comment \u05D0\u2136\u05d3\u05d7 */
@@ -44,12 +41,12 @@ class Unicode1 extends GroovyTestCase {
         /***/ // Also valid
     }
 
-    public void testStringLiterals() {
+    void testStringLiterals() {
         assert 1 == "\u0040".length()
         assert "A" == "\u0041"
     }
 
-    public void testCharNotAvailableAsLiteral() {
+    void testCharNotAvailableAsLiteral() {
         char a = 'x'
         char b = "x"
         def c = "x".charAt(0)

http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s01/Unicode2.groovy
----------------------------------------------------------------------
diff --git a/src/tck/test/gls/ch03/s01/Unicode2.groovy b/src/tck/test/gls/ch03/s01/Unicode2.groovy
index be60ff6..35fbf72 100644
--- a/src/tck/test/gls/ch03/s01/Unicode2.groovy
+++ b/src/tck/test/gls/ch03/s01/Unicode2.groovy
@@ -17,24 +17,20 @@
  *  under the License.
  */
 package gls.ch03.s01;
+
 /**
  * Except for comments, identifiers and the contents of ... string 
  * literals, all input elements are formed from ASCII characters.
- *
- * TODO: Find a better way to test these things
- * Note that this is a little hard to test since the input file is ASCII.
- *
- * @author Jeremy Rayner
  */
-
 class Unicode2 extends GroovyTestCase {
 
-//todo - this doesn't seem to work in raw Java5.0 either
-//    public void testUTF16SupplementaryCharacters() {
-//        assert 1 == "\uD840\uDC00".length()
-//    }
+    void testUTF16SupplementaryCharacters() {
+        def s = "\uD840\uDC00"
+        assert 2 == s.length() // number of Unicode code units
+        assert 1 == s.codePointCount(0, s.length()) // number of Unicode code points
+    }
 
-    public void testIdentifiers() {
+    void testIdentifiers() {
         def foo\u0044 = 12
         assert 20 == foo\u0044 + 8
     }

http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s02/LexicalTranslation1.groovy
----------------------------------------------------------------------
diff --git a/src/tck/test/gls/ch03/s02/LexicalTranslation1.groovy b/src/tck/test/gls/ch03/s02/LexicalTranslation1.groovy
index 6290c69..1c27135 100644
--- a/src/tck/test/gls/ch03/s02/LexicalTranslation1.groovy
+++ b/src/tck/test/gls/ch03/s02/LexicalTranslation1.groovy
@@ -18,8 +18,8 @@
  */
 package gls.ch03.s02
 
-/** Checks Lexical Translation steps as defined in $3.2 of GLS
- * @author Jeremy Rayner
+/**
+ * Checks Lexical Translation steps as defined in $3.2 of GLS
  */
 class LexicalTranslation1 extends GroovyTestCase {
     void testTranslationOfUnicodeEscapes() {

http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s02/Longest1.groovy
----------------------------------------------------------------------
diff --git a/src/tck/test/gls/ch03/s02/Longest1.groovy b/src/tck/test/gls/ch03/s02/Longest1.groovy
index 330c325..940f3c6 100644
--- a/src/tck/test/gls/ch03/s02/Longest1.groovy
+++ b/src/tck/test/gls/ch03/s02/Longest1.groovy
@@ -27,8 +27,6 @@ package gls.ch03.s02
  * it, other tests (e.g. to test functionality of operators or identifier
  * names) would expose it quickly. Nevertheless, we test some combinations
  * here for consistency.
- *
- * @author Alan Green
  */
 class Longest1 extends GroovyTestCase {
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s03/UnicodeEscapes1.groovy
----------------------------------------------------------------------
diff --git a/src/tck/test/gls/ch03/s03/UnicodeEscapes1.groovy b/src/tck/test/gls/ch03/s03/UnicodeEscapes1.groovy
index 09a4adf..6411c34 100644
--- a/src/tck/test/gls/ch03/s03/UnicodeEscapes1.groovy
+++ b/src/tck/test/gls/ch03/s03/UnicodeEscapes1.groovy
@@ -17,17 +17,14 @@
  *  under the License.
  */
 package gls.ch03.s03
+
 /**
  * GLS 3.3:
  * Implementations first recognize Unicode escapes in their input, translating 
  * the ASCII characters backslash and 'u' followed by four hexadecimal digits
  * to the Unicode character with the indicated hexadecimal value, and passing
  * all other characters unchanged.  
- *
- * @author Alan Green
- * @author Jeremy Rayner
  */
-
 class UnicodeEscapes1 extends GroovyTestCase {
 
     void testAllHexDigits() {

http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s03/UnicodeEscapes2.groovy
----------------------------------------------------------------------
diff --git a/src/tck/test/gls/ch03/s03/UnicodeEscapes2.groovy b/src/tck/test/gls/ch03/s03/UnicodeEscapes2.groovy
index bcf8259..58eafbe 100644
--- a/src/tck/test/gls/ch03/s03/UnicodeEscapes2.groovy
+++ b/src/tck/test/gls/ch03/s03/UnicodeEscapes2.groovy
@@ -17,16 +17,14 @@
  *  under the License.
  */
 package gls.ch03.s03
+
 /**
  * GLS 3.3:
  * Implementations first recognize Unicode escapes in their input, translating 
  * the ASCII characters backslash and 'u' followed by four hexadecimal digits
  * to the Unicode character with the indicated hexadecimal value, and passing
  * all other characters unchanged.  
- *
- * @author Alan Green
  */
-
 class UnicodeEscapes2 extends GroovyTestCase {
 
     // GLS: If an even number of backslashes precede the 'u', it is not 
@@ -49,21 +47,22 @@ class UnicodeEscapes2 extends GroovyTestCase {
     // is not followed by four hexadecimal digits, then a compile-time error
     // occurs.
     void testFourHexDigits() {
-        // these next lines won't work. The backslash has been replace by a 
-        // forwards slash so that the file parses. (Comments don't comment out
-        // unicode escapes.)
+        // If five digits, only the first four count
+        def \u00610 = 2
+        assert a0 == 2
+
+        // Subsequent lines won't work. The backslash has been replaced by a forward slash
+        // so that the file parses. (Comments don't comment out unicode escapes.)
         // assert "/u7" == "\07" //@fail:parse 
         // def /u61 = 2 //@fail:parse 
         // def /u061 = 2 //@fail:parse 
-
-        // If five digits, only the first four count
-        def \u00610 = 2 
-        assert a0 == 2
     }
+
     void testInvalidHexDigits() {
-        // invalid hex digits
-        // assert "\ufffg" == "a" // @fail:parse
-        // assert "\uu006g" == "a" // @fail:parse
-        // assert "\uab cd" == "acd" // @fail:parse
+        // Subsequent lines won't work. The backslash has been replaced by a forward slash
+        // so that the file parses. (Comments don't comment out unicode escapes.)
+        // assert "/ufffg" == "a" // @fail:parse
+        // assert "/uu006g" == "a" // @fail:parse
+        // assert "/uab cd" == "acd" // @fail:parse
     }
 }


Mime
View raw message