You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2018/01/04 20:27:35 UTC

[royale-asjs] branch develop updated: Added string utils

This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4bf4b6c  Added string utils
4bf4b6c is described below

commit 4bf4b6cc73cdd74d21bcb17a90373242301a45ce
Author: Harbs <ha...@in-tools.com>
AuthorDate: Thu Jan 4 15:27:29 2018 -0500

    Added string utils
---
 .../projects/Core/src/main/royale/CoreClasses.as   |  6 ++
 .../org/apache/royale/utils/string/contains.as}    | 27 ++++----
 .../royale/org/apache/royale/utils/string/trim.as  | 54 ++++++++++++++++
 .../org/apache/royale/utils/string/trimLeft.as}    | 40 ++++++++----
 .../org/apache/royale/utils/string/trimRight.as}   | 42 ++++++++----
 .../src/test/royale/flexUnitTests/CoreTester.as    |  1 +
 .../test/royale/flexUnitTests/StringUtilsTest.as   | 74 ++++++++++++++++++++++
 7 files changed, 207 insertions(+), 37 deletions(-)

diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as
index a74ad70..2d13773 100644
--- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
@@ -232,6 +232,12 @@ internal class CoreClasses
 	import org.apache.royale.utils.loadBeadFromValuesManager; loadBeadFromValuesManager;
 
 	import org.apache.royale.utils.array.rangeCheck; rangeCheck;
+
+	import org.apache.royale.utils.string.contains; contains;
+	import org.apache.royale.utils.string.trim; trim;
+	import org.apache.royale.utils.string.trimRight; trimRight;
+	import org.apache.royale.utils.string.trimLeft; trimLeft;
+
 	import org.apache.royale.utils.date.addDays; addDays;
 	import org.apache.royale.utils.date.addHours; addHours;
 	import org.apache.royale.utils.date.addMinutes; addMinutes;
diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/contains.as
similarity index 59%
copy from frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
copy to frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/contains.as
index 3c9c5bf..2e16d52 100644
--- a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/contains.as
@@ -4,7 +4,7 @@
 //  contributor license agreements.  See the NOTICE file distributed with
 //  this work for additional information regarding copyright ownership.
 //  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
+//  (the "Licens"); you may not use this file except in compliance with
 //  the License.  You may obtain a copy of the License at
 //
 //      http://www.apache.org/licenses/LICENSE-2.0
@@ -16,17 +16,20 @@
 //  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////
-package flexUnitTests
+package org.apache.royale.utils.string
 {
-    [Suite]
-    [RunWith("org.flexunit.runners.Suite")]
-    public class CoreTester
+    import org.apache.royale.debugging.assert;
+	/**
+	 *  Checks whether a string contains the specified substring.
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+    public function contains(string:String,value:String):Boolean
     {
-        public var strandTesterTest:StrandTesterTest;
-		public var binaryDataTesterTest:BinaryDataTesterTest;
-		public var arrayUtilsTest:ArrayUtilsTest;
-		public var dateUtilsTest:DateUtilsTest;
-        public var keyConverterTest:KeyConverterTest;
-        public var keyboardEventConverterTest:KeyboardEventConverterTest;
+        assert(string != null,"contains() cannot be called with a null string");
+        assert(string != null,"contains() cannot be called with a null substring");
+        return string.indexOf(value) != -1;
     }
-}
+}
\ No newline at end of file
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trim.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trim.as
new file mode 100644
index 0000000..2d93f90
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trim.as
@@ -0,0 +1,54 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "Licens"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.utils.string
+{
+    import org.apache.royale.debugging.assert;
+	/**
+	 *  Trims all whitespace off the beginning and end of a string.
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+    public function trim(str:String):String
+    {
+        assert(str != null,"trim() cannot be called on null");
+
+        COMPILE::SWF
+        {
+            var startIndex:int = 0;
+            while (isWhitespace(str.charAt(startIndex)))
+                ++startIndex;
+            
+            var endIndex:int = str.length - 1;
+            while (isWhitespace(str.charAt(endIndex)))
+                --endIndex;
+            
+            if (endIndex >= startIndex)
+                return str.slice(startIndex, endIndex + 1);
+            else
+                return "";
+        }
+
+        COMPILE::JS
+        {
+            return str.trim();
+        }
+    }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimLeft.as
similarity index 53%
copy from frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
copy to frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimLeft.as
index 3c9c5bf..0842830 100644
--- a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimLeft.as
@@ -4,7 +4,7 @@
 //  contributor license agreements.  See the NOTICE file distributed with
 //  this work for additional information regarding copyright ownership.
 //  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
+//  (the "Licens"); you may not use this file except in compliance with
 //  the License.  You may obtain a copy of the License at
 //
 //      http://www.apache.org/licenses/LICENSE-2.0
@@ -16,17 +16,31 @@
 //  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////
-package flexUnitTests
+package org.apache.royale.utils.string
 {
-    [Suite]
-    [RunWith("org.flexunit.runners.Suite")]
-    public class CoreTester
+    import org.apache.royale.debugging.assert;
+	/**
+	 *  Checks that an index falls within the allowable range of an array.
+	 *  Returns true if it's valid, false if not.
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+    public function trimLeft(str:String):String
     {
-        public var strandTesterTest:StrandTesterTest;
-		public var binaryDataTesterTest:BinaryDataTesterTest;
-		public var arrayUtilsTest:ArrayUtilsTest;
-		public var dateUtilsTest:DateUtilsTest;
-        public var keyConverterTest:KeyConverterTest;
-        public var keyboardEventConverterTest:KeyboardEventConverterTest;
-    }
-}
+        assert(str != null,"trim() cannot be called on null");
+
+        COMPILE::SWF{
+            var startIndex:int = 0;
+            while (isWhitespace(str.charAt(startIndex)))
+                ++startIndex;
+            
+            return str.slice(startIndex);
+        }
+
+        COMPILE::JS{
+            return str.trimLeft();
+        }
+    }   
+}
\ No newline at end of file
diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimRight.as
similarity index 50%
copy from frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
copy to frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimRight.as
index 3c9c5bf..3370286 100644
--- a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimRight.as
@@ -4,7 +4,7 @@
 //  contributor license agreements.  See the NOTICE file distributed with
 //  this work for additional information regarding copyright ownership.
 //  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
+//  (the "Licens"); you may not use this file except in compliance with
 //  the License.  You may obtain a copy of the License at
 //
 //      http://www.apache.org/licenses/LICENSE-2.0
@@ -16,17 +16,35 @@
 //  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////
-package flexUnitTests
+package org.apache.royale.utils.string
 {
-    [Suite]
-    [RunWith("org.flexunit.runners.Suite")]
-    public class CoreTester
+    import org.apache.royale.debugging.assert;
+	/**
+	 *  Trims all whitespace off the end of a string.
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+    public function trimRight(str:String):String
     {
-        public var strandTesterTest:StrandTesterTest;
-		public var binaryDataTesterTest:BinaryDataTesterTest;
-		public var arrayUtilsTest:ArrayUtilsTest;
-		public var dateUtilsTest:DateUtilsTest;
-        public var keyConverterTest:KeyConverterTest;
-        public var keyboardEventConverterTest:KeyboardEventConverterTest;
+        assert(str != null,"trim() cannot be called on null");
+
+        COMPILE::SWF{
+            var startIndex:int = 0;
+            
+            var endIndex:int = str.length - 1;
+            while (isWhitespace(str.charAt(endIndex)))
+                --endIndex;
+            
+            if (endIndex >= startIndex)
+                return str.slice(startIndex, endIndex + 1);
+            else
+                return "";
+        }
+
+        COMPILE::JS{
+            return str.trimRight();
+        }
     }
-}
+}
\ No newline at end of file
diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as b/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
index 3c9c5bf..2f99400 100644
--- a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
+++ b/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
@@ -28,5 +28,6 @@ package flexUnitTests
 		public var dateUtilsTest:DateUtilsTest;
         public var keyConverterTest:KeyConverterTest;
         public var keyboardEventConverterTest:KeyboardEventConverterTest;
+        public var stringUtilsTest:StringUtilsTest;
     }
 }
diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/StringUtilsTest.as b/frameworks/projects/Core/src/test/royale/flexUnitTests/StringUtilsTest.as
new file mode 100644
index 0000000..5390817
--- /dev/null
+++ b/frameworks/projects/Core/src/test/royale/flexUnitTests/StringUtilsTest.as
@@ -0,0 +1,74 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests
+{
+    import org.apache.royale.utils.string.*;
+    import org.apache.royale.test.asserts.*;
+    
+    public class StringUtilsTest
+    {		
+        [Before]
+        public function setUp():void
+        {
+        }
+        
+        [After]
+        public function tearDown():void
+        {
+        }
+        
+        [BeforeClass]
+        public static function setUpBeforeClass():void
+        {
+        }
+        
+        [AfterClass]
+        public static function tearDownAfterClass():void
+        {
+        }
+        
+        [Test]
+        public function testContains():void
+        {
+            assertTrue(contains("food","foo"),"food contains foo");
+            assertTrue(!contains("foo","food"),"foo does not contain food");
+            assertTrue(!contains("food","baz"),"food does not contain baz");
+        }
+
+        [Test]
+        public function testTrim():void
+        {
+            assertTrue(trim("  foo  ") == "foo","Should be 'foo'");
+        }
+
+        [Test]
+        public function testTrimLeft():void
+        {
+            assertTrue(trimLeft("  foo  ") == "foo  ","Should be 'foo  ' (with spaces after)");
+        }
+
+        [Test]
+        public function testTrimRight():void
+        {
+            assertTrue(trimRight("  foo  ") == "  foo","Should be '  foo' (with spaces before)");
+        }
+
+
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <co...@royale.apache.org>'].

Re: [royale-asjs] branch develop updated: Added string utils

Posted by Alex Harui <ah...@adobe.com.INVALID>.
If you don't have AIR_HOME set, then yes, the SWF SWCs are not built.

-Alex

On 1/4/18, 3:34 PM, "Gabe Harbs" <ha...@gmail.com> wrote:

>I’m not sure why my local build did not fail on this.
>
>The swf compile was missing the isWhitespace function, so it failed.
>
>Is it possible that the swf compile is not being run?
>
>> On Jan 4, 2018, at 3:27 PM, harbs@apache.org wrote:
>> 
>> This is an automated email from the ASF dual-hosted git repository.
>> 
>> harbs pushed a commit to branch develop
>> in repository 
>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.a
>>pache.org%2Frepos%2Fasf%2Froyale-asjs.git&data=02%7C01%7Caharui%40adobe.c
>>om%7Ce2b100f57bfa4ac8681008d553cbc952%7Cfa7b1b5a7b34438794aed2c178decee1%
>>7C0%7C0%7C636507057081236023&sdata=cJf7cXKtsoWXJ8jDJk9EyFDzhGR47A4z%2Fty8
>>cZ%2F9Zak%3D&reserved=0
>> 
>> 
>> The following commit(s) were added to refs/heads/develop by this push:
>>     new 4bf4b6c  Added string utils
>> 4bf4b6c is described below
>> 
>> commit 4bf4b6cc73cdd74d21bcb17a90373242301a45ce
>> Author: Harbs <ha...@in-tools.com>
>> AuthorDate: Thu Jan 4 15:27:29 2018 -0500
>> 
>>    Added string utils
>> ---
>> .../projects/Core/src/main/royale/CoreClasses.as   |  6 ++
>> .../org/apache/royale/utils/string/contains.as}    | 27 ++++----
>> .../royale/org/apache/royale/utils/string/trim.as  | 54 ++++++++++++++++
>> .../org/apache/royale/utils/string/trimLeft.as}    | 40 ++++++++----
>> .../org/apache/royale/utils/string/trimRight.as}   | 42 ++++++++----
>> .../src/test/royale/flexUnitTests/CoreTester.as    |  1 +
>> .../test/royale/flexUnitTests/StringUtilsTest.as   | 74
>>++++++++++++++++++++++
>> 7 files changed, 207 insertions(+), 37 deletions(-)
>> 
>> diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as
>>b/frameworks/projects/Core/src/main/royale/CoreClasses.as
>> index a74ad70..2d13773 100644
>> --- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
>> +++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
>> @@ -232,6 +232,12 @@ internal class CoreClasses
>> 	import org.apache.royale.utils.loadBeadFromValuesManager;
>>loadBeadFromValuesManager;
>> 
>> 	import org.apache.royale.utils.array.rangeCheck; rangeCheck;
>> +
>> +	import org.apache.royale.utils.string.contains; contains;
>> +	import org.apache.royale.utils.string.trim; trim;
>> +	import org.apache.royale.utils.string.trimRight; trimRight;
>> +	import org.apache.royale.utils.string.trimLeft; trimLeft;
>> +
>> 	import org.apache.royale.utils.date.addDays; addDays;
>> 	import org.apache.royale.utils.date.addHours; addHours;
>> 	import org.apache.royale.utils.date.addMinutes; addMinutes;
>> diff --git 
>>a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>>b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string
>>/contains.as
>> similarity index 59%
>> copy from 
>>frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>> copy to 
>>frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/c
>>ontains.as
>> index 3c9c5bf..2e16d52 100644
>> --- 
>>a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>> +++ 
>>b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string
>>/contains.as
>> @@ -4,7 +4,7 @@
>> //  contributor license agreements.  See the NOTICE file distributed
>>with
>> //  this work for additional information regarding copyright ownership.
>> //  The ASF licenses this file to You under the Apache License, Version
>>2.0
>> -//  (the "License"); you may not use this file except in compliance
>>with
>> +//  (the "Licens"); you may not use this file except in compliance with
>> //  the License.  You may obtain a copy of the License at
>> //
>> //      
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach
>>e.org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7Caharui%40adobe.com%7Ce2b100
>>f57bfa4ac8681008d553cbc952%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>>36507057081236023&sdata=Jz4ibhG0bW8AWxz%2FFCH5zKND34HI81H3QNeiqm62JIw%3D&
>>reserved=0
>> @@ -16,17 +16,20 @@
>> //  limitations under the License.
>> //
>> 
>>/////////////////////////////////////////////////////////////////////////
>>///////
>> -package flexUnitTests
>> +package org.apache.royale.utils.string
>> {
>> -    [Suite]
>> -    [RunWith("org.flexunit.runners.Suite")]
>> -    public class CoreTester
>> +    import org.apache.royale.debugging.assert;
>> +	/**
>> +	 *  Checks whether a string contains the specified substring.
>> +	 *  @langversion 3.0
>> +	 *  @playerversion Flash 10.2
>> +	 *  @playerversion AIR 2.6
>> +	 *  @productversion Royale 0.9
>> +	 */
>> +    public function contains(string:String,value:String):Boolean
>>     {
>> -        public var strandTesterTest:StrandTesterTest;
>> -		public var binaryDataTesterTest:BinaryDataTesterTest;
>> -		public var arrayUtilsTest:ArrayUtilsTest;
>> -		public var dateUtilsTest:DateUtilsTest;
>> -        public var keyConverterTest:KeyConverterTest;
>> -        public var
>>keyboardEventConverterTest:KeyboardEventConverterTest;
>> +        assert(string != null,"contains() cannot be called with a null
>>string");
>> +        assert(string != null,"contains() cannot be called with a null
>>substring");
>> +        return string.indexOf(value) != -1;
>>     }
>> -}
>> +}
>> \ No newline at end of file
>> diff --git 
>>a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string
>>/trim.as 
>>b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string
>>/trim.as
>> new file mode 100644
>> index 0000000..2d93f90
>> --- /dev/null
>> +++ 
>>b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string
>>/trim.as
>> @@ -0,0 +1,54 @@
>> 
>>+////////////////////////////////////////////////////////////////////////
>>////////
>> +//
>> +//  Licensed to the Apache Software Foundation (ASF) under one or more
>> +//  contributor license agreements.  See the NOTICE file distributed
>>with
>> +//  this work for additional information regarding copyright ownership.
>> +//  The ASF licenses this file to You under the Apache License,
>>Version 2.0
>> +//  (the "Licens"); you may not use this file except in compliance with
>> +//  the License.  You may obtain a copy of the License at
>> +//
>> +//      
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach
>>e.org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7Caharui%40adobe.com%7Ce2b100
>>f57bfa4ac8681008d553cbc952%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>>36507057081236023&sdata=Jz4ibhG0bW8AWxz%2FFCH5zKND34HI81H3QNeiqm62JIw%3D&
>>reserved=0
>> +//
>> +//  Unless required by applicable law or agreed to in writing, software
>> +//  distributed under the License is distributed on an "AS IS" BASIS,
>> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>implied.
>> +//  See the License for the specific language governing permissions and
>> +//  limitations under the License.
>> +//
>> 
>>+////////////////////////////////////////////////////////////////////////
>>////////
>> +package org.apache.royale.utils.string
>> +{
>> +    import org.apache.royale.debugging.assert;
>> +	/**
>> +	 *  Trims all whitespace off the beginning and end of a string.
>> +	 *  @langversion 3.0
>> +	 *  @playerversion Flash 10.2
>> +	 *  @playerversion AIR 2.6
>> +	 *  @productversion Royale 0.9
>> +	 */
>> +    public function trim(str:String):String
>> +    {
>> +        assert(str != null,"trim() cannot be called on null");
>> +
>> +        COMPILE::SWF
>> +        {
>> +            var startIndex:int = 0;
>> +            while (isWhitespace(str.charAt(startIndex)))
>> +                ++startIndex;
>> +            
>> +            var endIndex:int = str.length - 1;
>> +            while (isWhitespace(str.charAt(endIndex)))
>> +                --endIndex;
>> +            
>> +            if (endIndex >= startIndex)
>> +                return str.slice(startIndex, endIndex + 1);
>> +            else
>> +                return "";
>> +        }
>> +
>> +        COMPILE::JS
>> +        {
>> +            return str.trim();
>> +        }
>> +    }
>> +}
>> \ No newline at end of file
>> diff --git 
>>a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>>b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string
>>/trimLeft.as
>> similarity index 53%
>> copy from 
>>frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>> copy to 
>>frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/t
>>rimLeft.as
>> index 3c9c5bf..0842830 100644
>> --- 
>>a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>> +++ 
>>b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string
>>/trimLeft.as
>> @@ -4,7 +4,7 @@
>> //  contributor license agreements.  See the NOTICE file distributed
>>with
>> //  this work for additional information regarding copyright ownership.
>> //  The ASF licenses this file to You under the Apache License, Version
>>2.0
>> -//  (the "License"); you may not use this file except in compliance
>>with
>> +//  (the "Licens"); you may not use this file except in compliance with
>> //  the License.  You may obtain a copy of the License at
>> //
>> //      
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach
>>e.org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7Caharui%40adobe.com%7Ce2b100
>>f57bfa4ac8681008d553cbc952%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>>36507057081236023&sdata=Jz4ibhG0bW8AWxz%2FFCH5zKND34HI81H3QNeiqm62JIw%3D&
>>reserved=0
>> @@ -16,17 +16,31 @@
>> //  limitations under the License.
>> //
>> 
>>/////////////////////////////////////////////////////////////////////////
>>///////
>> -package flexUnitTests
>> +package org.apache.royale.utils.string
>> {
>> -    [Suite]
>> -    [RunWith("org.flexunit.runners.Suite")]
>> -    public class CoreTester
>> +    import org.apache.royale.debugging.assert;
>> +	/**
>> +	 *  Checks that an index falls within the allowable range of an array.
>> +	 *  Returns true if it's valid, false if not.
>> +	 *  @langversion 3.0
>> +	 *  @playerversion Flash 10.2
>> +	 *  @playerversion AIR 2.6
>> +	 *  @productversion Royale 0.9
>> +	 */
>> +    public function trimLeft(str:String):String
>>     {
>> -        public var strandTesterTest:StrandTesterTest;
>> -		public var binaryDataTesterTest:BinaryDataTesterTest;
>> -		public var arrayUtilsTest:ArrayUtilsTest;
>> -		public var dateUtilsTest:DateUtilsTest;
>> -        public var keyConverterTest:KeyConverterTest;
>> -        public var
>>keyboardEventConverterTest:KeyboardEventConverterTest;
>> -    }
>> -}
>> +        assert(str != null,"trim() cannot be called on null");
>> +
>> +        COMPILE::SWF{
>> +            var startIndex:int = 0;
>> +            while (isWhitespace(str.charAt(startIndex)))
>> +                ++startIndex;
>> +            
>> +            return str.slice(startIndex);
>> +        }
>> +
>> +        COMPILE::JS{
>> +            return str.trimLeft();
>> +        }
>> +    }   
>> +}
>> \ No newline at end of file
>> diff --git 
>>a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>>b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string
>>/trimRight.as
>> similarity index 50%
>> copy from 
>>frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>> copy to 
>>frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/t
>>rimRight.as
>> index 3c9c5bf..3370286 100644
>> --- 
>>a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>> +++ 
>>b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string
>>/trimRight.as
>> @@ -4,7 +4,7 @@
>> //  contributor license agreements.  See the NOTICE file distributed
>>with
>> //  this work for additional information regarding copyright ownership.
>> //  The ASF licenses this file to You under the Apache License, Version
>>2.0
>> -//  (the "License"); you may not use this file except in compliance
>>with
>> +//  (the "Licens"); you may not use this file except in compliance with
>> //  the License.  You may obtain a copy of the License at
>> //
>> //      
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach
>>e.org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7Caharui%40adobe.com%7Ce2b100
>>f57bfa4ac8681008d553cbc952%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>>36507057081236023&sdata=Jz4ibhG0bW8AWxz%2FFCH5zKND34HI81H3QNeiqm62JIw%3D&
>>reserved=0
>> @@ -16,17 +16,35 @@
>> //  limitations under the License.
>> //
>> 
>>/////////////////////////////////////////////////////////////////////////
>>///////
>> -package flexUnitTests
>> +package org.apache.royale.utils.string
>> {
>> -    [Suite]
>> -    [RunWith("org.flexunit.runners.Suite")]
>> -    public class CoreTester
>> +    import org.apache.royale.debugging.assert;
>> +	/**
>> +	 *  Trims all whitespace off the end of a string.
>> +	 *  @langversion 3.0
>> +	 *  @playerversion Flash 10.2
>> +	 *  @playerversion AIR 2.6
>> +	 *  @productversion Royale 0.9
>> +	 */
>> +    public function trimRight(str:String):String
>>     {
>> -        public var strandTesterTest:StrandTesterTest;
>> -		public var binaryDataTesterTest:BinaryDataTesterTest;
>> -		public var arrayUtilsTest:ArrayUtilsTest;
>> -		public var dateUtilsTest:DateUtilsTest;
>> -        public var keyConverterTest:KeyConverterTest;
>> -        public var
>>keyboardEventConverterTest:KeyboardEventConverterTest;
>> +        assert(str != null,"trim() cannot be called on null");
>> +
>> +        COMPILE::SWF{
>> +            var startIndex:int = 0;
>> +            
>> +            var endIndex:int = str.length - 1;
>> +            while (isWhitespace(str.charAt(endIndex)))
>> +                --endIndex;
>> +            
>> +            if (endIndex >= startIndex)
>> +                return str.slice(startIndex, endIndex + 1);
>> +            else
>> +                return "";
>> +        }
>> +
>> +        COMPILE::JS{
>> +            return str.trimRight();
>> +        }
>>     }
>> -}
>> +}
>> \ No newline at end of file
>> diff --git 
>>a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>>b/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>> index 3c9c5bf..2f99400 100644
>> --- 
>>a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>> +++ 
>>b/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
>> @@ -28,5 +28,6 @@ package flexUnitTests
>> 		public var dateUtilsTest:DateUtilsTest;
>>         public var keyConverterTest:KeyConverterTest;
>>         public var
>>keyboardEventConverterTest:KeyboardEventConverterTest;
>> +        public var stringUtilsTest:StringUtilsTest;
>>     }
>> }
>> diff --git 
>>a/frameworks/projects/Core/src/test/royale/flexUnitTests/StringUtilsTest.
>>as 
>>b/frameworks/projects/Core/src/test/royale/flexUnitTests/StringUtilsTest.
>>as
>> new file mode 100644
>> index 0000000..5390817
>> --- /dev/null
>> +++ 
>>b/frameworks/projects/Core/src/test/royale/flexUnitTests/StringUtilsTest.
>>as
>> @@ -0,0 +1,74 @@
>> 
>>+////////////////////////////////////////////////////////////////////////
>>////////
>> +//
>> +//  Licensed to the Apache Software Foundation (ASF) under one or more
>> +//  contributor license agreements.  See the NOTICE file distributed
>>with
>> +//  this work for additional information regarding copyright ownership.
>> +//  The ASF licenses this file to You under the Apache License,
>>Version 2.0
>> +//  (the "License"); you may not use this file except in compliance
>>with
>> +//  the License.  You may obtain a copy of the License at
>> +//
>> +//      
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach
>>e.org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7Caharui%40adobe.com%7Ce2b100
>>f57bfa4ac8681008d553cbc952%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>>36507057081236023&sdata=Jz4ibhG0bW8AWxz%2FFCH5zKND34HI81H3QNeiqm62JIw%3D&
>>reserved=0
>> +//
>> +//  Unless required by applicable law or agreed to in writing, software
>> +//  distributed under the License is distributed on an "AS IS" BASIS,
>> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>implied.
>> +//  See the License for the specific language governing permissions and
>> +//  limitations under the License.
>> +//
>> 
>>+////////////////////////////////////////////////////////////////////////
>>////////
>> +package flexUnitTests
>> +{
>> +    import org.apache.royale.utils.string.*;
>> +    import org.apache.royale.test.asserts.*;
>> +    
>> +    public class StringUtilsTest
>> +    {		
>> +        [Before]
>> +        public function setUp():void
>> +        {
>> +        }
>> +        
>> +        [After]
>> +        public function tearDown():void
>> +        {
>> +        }
>> +        
>> +        [BeforeClass]
>> +        public static function setUpBeforeClass():void
>> +        {
>> +        }
>> +        
>> +        [AfterClass]
>> +        public static function tearDownAfterClass():void
>> +        {
>> +        }
>> +        
>> +        [Test]
>> +        public function testContains():void
>> +        {
>> +            assertTrue(contains("food","foo"),"food contains foo");
>> +            assertTrue(!contains("foo","food"),"foo does not contain
>>food");
>> +            assertTrue(!contains("food","baz"),"food does not contain
>>baz");
>> +        }
>> +
>> +        [Test]
>> +        public function testTrim():void
>> +        {
>> +            assertTrue(trim("  foo  ") == "foo","Should be 'foo'");
>> +        }
>> +
>> +        [Test]
>> +        public function testTrimLeft():void
>> +        {
>> +            assertTrue(trimLeft("  foo  ") == "foo  ","Should be 'foo
>>' (with spaces after)");
>> +        }
>> +
>> +        [Test]
>> +        public function testTrimRight():void
>> +        {
>> +            assertTrue(trimRight("  foo  ") == "  foo","Should be '
>>foo' (with spaces before)");
>> +        }
>> +
>> +
>> +    }
>> +}
>> 
>> -- 
>> To stop receiving notification emails like this one, please contact
>> ['"commits@royale.apache.org" <co...@royale.apache.org>'].
>


Re: [royale-asjs] branch develop updated: Added string utils

Posted by Gabe Harbs <ha...@gmail.com>.
I’m not sure why my local build did not fail on this.

The swf compile was missing the isWhitespace function, so it failed.

Is it possible that the swf compile is not being run?

> On Jan 4, 2018, at 3:27 PM, harbs@apache.org wrote:
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> harbs pushed a commit to branch develop
> in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
> 
> 
> The following commit(s) were added to refs/heads/develop by this push:
>     new 4bf4b6c  Added string utils
> 4bf4b6c is described below
> 
> commit 4bf4b6cc73cdd74d21bcb17a90373242301a45ce
> Author: Harbs <ha...@in-tools.com>
> AuthorDate: Thu Jan 4 15:27:29 2018 -0500
> 
>    Added string utils
> ---
> .../projects/Core/src/main/royale/CoreClasses.as   |  6 ++
> .../org/apache/royale/utils/string/contains.as}    | 27 ++++----
> .../royale/org/apache/royale/utils/string/trim.as  | 54 ++++++++++++++++
> .../org/apache/royale/utils/string/trimLeft.as}    | 40 ++++++++----
> .../org/apache/royale/utils/string/trimRight.as}   | 42 ++++++++----
> .../src/test/royale/flexUnitTests/CoreTester.as    |  1 +
> .../test/royale/flexUnitTests/StringUtilsTest.as   | 74 ++++++++++++++++++++++
> 7 files changed, 207 insertions(+), 37 deletions(-)
> 
> diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as
> index a74ad70..2d13773 100644
> --- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
> +++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
> @@ -232,6 +232,12 @@ internal class CoreClasses
> 	import org.apache.royale.utils.loadBeadFromValuesManager; loadBeadFromValuesManager;
> 
> 	import org.apache.royale.utils.array.rangeCheck; rangeCheck;
> +
> +	import org.apache.royale.utils.string.contains; contains;
> +	import org.apache.royale.utils.string.trim; trim;
> +	import org.apache.royale.utils.string.trimRight; trimRight;
> +	import org.apache.royale.utils.string.trimLeft; trimLeft;
> +
> 	import org.apache.royale.utils.date.addDays; addDays;
> 	import org.apache.royale.utils.date.addHours; addHours;
> 	import org.apache.royale.utils.date.addMinutes; addMinutes;
> diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/contains.as
> similarity index 59%
> copy from frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
> copy to frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/contains.as
> index 3c9c5bf..2e16d52 100644
> --- a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
> +++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/contains.as
> @@ -4,7 +4,7 @@
> //  contributor license agreements.  See the NOTICE file distributed with
> //  this work for additional information regarding copyright ownership.
> //  The ASF licenses this file to You under the Apache License, Version 2.0
> -//  (the "License"); you may not use this file except in compliance with
> +//  (the "Licens"); you may not use this file except in compliance with
> //  the License.  You may obtain a copy of the License at
> //
> //      http://www.apache.org/licenses/LICENSE-2.0
> @@ -16,17 +16,20 @@
> //  limitations under the License.
> //
> ////////////////////////////////////////////////////////////////////////////////
> -package flexUnitTests
> +package org.apache.royale.utils.string
> {
> -    [Suite]
> -    [RunWith("org.flexunit.runners.Suite")]
> -    public class CoreTester
> +    import org.apache.royale.debugging.assert;
> +	/**
> +	 *  Checks whether a string contains the specified substring.
> +	 *  @langversion 3.0
> +	 *  @playerversion Flash 10.2
> +	 *  @playerversion AIR 2.6
> +	 *  @productversion Royale 0.9
> +	 */
> +    public function contains(string:String,value:String):Boolean
>     {
> -        public var strandTesterTest:StrandTesterTest;
> -		public var binaryDataTesterTest:BinaryDataTesterTest;
> -		public var arrayUtilsTest:ArrayUtilsTest;
> -		public var dateUtilsTest:DateUtilsTest;
> -        public var keyConverterTest:KeyConverterTest;
> -        public var keyboardEventConverterTest:KeyboardEventConverterTest;
> +        assert(string != null,"contains() cannot be called with a null string");
> +        assert(string != null,"contains() cannot be called with a null substring");
> +        return string.indexOf(value) != -1;
>     }
> -}
> +}
> \ No newline at end of file
> diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trim.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trim.as
> new file mode 100644
> index 0000000..2d93f90
> --- /dev/null
> +++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trim.as
> @@ -0,0 +1,54 @@
> +////////////////////////////////////////////////////////////////////////////////
> +//
> +//  Licensed to the Apache Software Foundation (ASF) under one or more
> +//  contributor license agreements.  See the NOTICE file distributed with
> +//  this work for additional information regarding copyright ownership.
> +//  The ASF licenses this file to You under the Apache License, Version 2.0
> +//  (the "Licens"); you may not use this file except in compliance with
> +//  the License.  You may obtain a copy of the License at
> +//
> +//      http://www.apache.org/licenses/LICENSE-2.0
> +//
> +//  Unless required by applicable law or agreed to in writing, software
> +//  distributed under the License is distributed on an "AS IS" BASIS,
> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +//  See the License for the specific language governing permissions and
> +//  limitations under the License.
> +//
> +////////////////////////////////////////////////////////////////////////////////
> +package org.apache.royale.utils.string
> +{
> +    import org.apache.royale.debugging.assert;
> +	/**
> +	 *  Trims all whitespace off the beginning and end of a string.
> +	 *  @langversion 3.0
> +	 *  @playerversion Flash 10.2
> +	 *  @playerversion AIR 2.6
> +	 *  @productversion Royale 0.9
> +	 */
> +    public function trim(str:String):String
> +    {
> +        assert(str != null,"trim() cannot be called on null");
> +
> +        COMPILE::SWF
> +        {
> +            var startIndex:int = 0;
> +            while (isWhitespace(str.charAt(startIndex)))
> +                ++startIndex;
> +            
> +            var endIndex:int = str.length - 1;
> +            while (isWhitespace(str.charAt(endIndex)))
> +                --endIndex;
> +            
> +            if (endIndex >= startIndex)
> +                return str.slice(startIndex, endIndex + 1);
> +            else
> +                return "";
> +        }
> +
> +        COMPILE::JS
> +        {
> +            return str.trim();
> +        }
> +    }
> +}
> \ No newline at end of file
> diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimLeft.as
> similarity index 53%
> copy from frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
> copy to frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimLeft.as
> index 3c9c5bf..0842830 100644
> --- a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
> +++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimLeft.as
> @@ -4,7 +4,7 @@
> //  contributor license agreements.  See the NOTICE file distributed with
> //  this work for additional information regarding copyright ownership.
> //  The ASF licenses this file to You under the Apache License, Version 2.0
> -//  (the "License"); you may not use this file except in compliance with
> +//  (the "Licens"); you may not use this file except in compliance with
> //  the License.  You may obtain a copy of the License at
> //
> //      http://www.apache.org/licenses/LICENSE-2.0
> @@ -16,17 +16,31 @@
> //  limitations under the License.
> //
> ////////////////////////////////////////////////////////////////////////////////
> -package flexUnitTests
> +package org.apache.royale.utils.string
> {
> -    [Suite]
> -    [RunWith("org.flexunit.runners.Suite")]
> -    public class CoreTester
> +    import org.apache.royale.debugging.assert;
> +	/**
> +	 *  Checks that an index falls within the allowable range of an array.
> +	 *  Returns true if it's valid, false if not.
> +	 *  @langversion 3.0
> +	 *  @playerversion Flash 10.2
> +	 *  @playerversion AIR 2.6
> +	 *  @productversion Royale 0.9
> +	 */
> +    public function trimLeft(str:String):String
>     {
> -        public var strandTesterTest:StrandTesterTest;
> -		public var binaryDataTesterTest:BinaryDataTesterTest;
> -		public var arrayUtilsTest:ArrayUtilsTest;
> -		public var dateUtilsTest:DateUtilsTest;
> -        public var keyConverterTest:KeyConverterTest;
> -        public var keyboardEventConverterTest:KeyboardEventConverterTest;
> -    }
> -}
> +        assert(str != null,"trim() cannot be called on null");
> +
> +        COMPILE::SWF{
> +            var startIndex:int = 0;
> +            while (isWhitespace(str.charAt(startIndex)))
> +                ++startIndex;
> +            
> +            return str.slice(startIndex);
> +        }
> +
> +        COMPILE::JS{
> +            return str.trimLeft();
> +        }
> +    }   
> +}
> \ No newline at end of file
> diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimRight.as
> similarity index 50%
> copy from frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
> copy to frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimRight.as
> index 3c9c5bf..3370286 100644
> --- a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
> +++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/trimRight.as
> @@ -4,7 +4,7 @@
> //  contributor license agreements.  See the NOTICE file distributed with
> //  this work for additional information regarding copyright ownership.
> //  The ASF licenses this file to You under the Apache License, Version 2.0
> -//  (the "License"); you may not use this file except in compliance with
> +//  (the "Licens"); you may not use this file except in compliance with
> //  the License.  You may obtain a copy of the License at
> //
> //      http://www.apache.org/licenses/LICENSE-2.0
> @@ -16,17 +16,35 @@
> //  limitations under the License.
> //
> ////////////////////////////////////////////////////////////////////////////////
> -package flexUnitTests
> +package org.apache.royale.utils.string
> {
> -    [Suite]
> -    [RunWith("org.flexunit.runners.Suite")]
> -    public class CoreTester
> +    import org.apache.royale.debugging.assert;
> +	/**
> +	 *  Trims all whitespace off the end of a string.
> +	 *  @langversion 3.0
> +	 *  @playerversion Flash 10.2
> +	 *  @playerversion AIR 2.6
> +	 *  @productversion Royale 0.9
> +	 */
> +    public function trimRight(str:String):String
>     {
> -        public var strandTesterTest:StrandTesterTest;
> -		public var binaryDataTesterTest:BinaryDataTesterTest;
> -		public var arrayUtilsTest:ArrayUtilsTest;
> -		public var dateUtilsTest:DateUtilsTest;
> -        public var keyConverterTest:KeyConverterTest;
> -        public var keyboardEventConverterTest:KeyboardEventConverterTest;
> +        assert(str != null,"trim() cannot be called on null");
> +
> +        COMPILE::SWF{
> +            var startIndex:int = 0;
> +            
> +            var endIndex:int = str.length - 1;
> +            while (isWhitespace(str.charAt(endIndex)))
> +                --endIndex;
> +            
> +            if (endIndex >= startIndex)
> +                return str.slice(startIndex, endIndex + 1);
> +            else
> +                return "";
> +        }
> +
> +        COMPILE::JS{
> +            return str.trimRight();
> +        }
>     }
> -}
> +}
> \ No newline at end of file
> diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as b/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
> index 3c9c5bf..2f99400 100644
> --- a/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
> +++ b/frameworks/projects/Core/src/test/royale/flexUnitTests/CoreTester.as
> @@ -28,5 +28,6 @@ package flexUnitTests
> 		public var dateUtilsTest:DateUtilsTest;
>         public var keyConverterTest:KeyConverterTest;
>         public var keyboardEventConverterTest:KeyboardEventConverterTest;
> +        public var stringUtilsTest:StringUtilsTest;
>     }
> }
> diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/StringUtilsTest.as b/frameworks/projects/Core/src/test/royale/flexUnitTests/StringUtilsTest.as
> new file mode 100644
> index 0000000..5390817
> --- /dev/null
> +++ b/frameworks/projects/Core/src/test/royale/flexUnitTests/StringUtilsTest.as
> @@ -0,0 +1,74 @@
> +////////////////////////////////////////////////////////////////////////////////
> +//
> +//  Licensed to the Apache Software Foundation (ASF) under one or more
> +//  contributor license agreements.  See the NOTICE file distributed with
> +//  this work for additional information regarding copyright ownership.
> +//  The ASF licenses this file to You under the Apache License, Version 2.0
> +//  (the "License"); you may not use this file except in compliance with
> +//  the License.  You may obtain a copy of the License at
> +//
> +//      http://www.apache.org/licenses/LICENSE-2.0
> +//
> +//  Unless required by applicable law or agreed to in writing, software
> +//  distributed under the License is distributed on an "AS IS" BASIS,
> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +//  See the License for the specific language governing permissions and
> +//  limitations under the License.
> +//
> +////////////////////////////////////////////////////////////////////////////////
> +package flexUnitTests
> +{
> +    import org.apache.royale.utils.string.*;
> +    import org.apache.royale.test.asserts.*;
> +    
> +    public class StringUtilsTest
> +    {		
> +        [Before]
> +        public function setUp():void
> +        {
> +        }
> +        
> +        [After]
> +        public function tearDown():void
> +        {
> +        }
> +        
> +        [BeforeClass]
> +        public static function setUpBeforeClass():void
> +        {
> +        }
> +        
> +        [AfterClass]
> +        public static function tearDownAfterClass():void
> +        {
> +        }
> +        
> +        [Test]
> +        public function testContains():void
> +        {
> +            assertTrue(contains("food","foo"),"food contains foo");
> +            assertTrue(!contains("foo","food"),"foo does not contain food");
> +            assertTrue(!contains("food","baz"),"food does not contain baz");
> +        }
> +
> +        [Test]
> +        public function testTrim():void
> +        {
> +            assertTrue(trim("  foo  ") == "foo","Should be 'foo'");
> +        }
> +
> +        [Test]
> +        public function testTrimLeft():void
> +        {
> +            assertTrue(trimLeft("  foo  ") == "foo  ","Should be 'foo  ' (with spaces after)");
> +        }
> +
> +        [Test]
> +        public function testTrimRight():void
> +        {
> +            assertTrue(trimRight("  foo  ") == "  foo","Should be '  foo' (with spaces before)");
> +        }
> +
> +
> +    }
> +}
> 
> -- 
> To stop receiving notification emails like this one, please contact
> ['"commits@royale.apache.org" <co...@royale.apache.org>'].