You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2022/12/19 22:16:47 UTC

[royale-asjs] branch develop updated (0df828ab44 -> 3938fcc402)

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

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


    from 0df828ab44 RoyaleUnit: assertType and assertNotType
     new f1f19edb31 RoyaleUnit: assertMatch and assertNotMatch
     new 3938fcc402 RoyaleUnit: assertThrows

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/royale/org/apache/royale/test/Assert.as   | 84 ++++++++++++++++++++++
 .../asserts/{assertEquals.as => assertMatch.as}    |  6 +-
 .../{assertLessThan.as => assertNotMatch.as}       |  6 +-
 .../asserts/{assertEquals.as => assertThrows.as}   |  6 +-
 .../royale/org/apache/royale/test/bdd/IExpect.as   | 51 +++++++++++++
 .../royale/org/apache/royale/test/bdd/expect.as    | 51 +++++++++++++
 .../src/test/royale/tests/AssertTests.as           | 59 +++++++++++++++
 .../src/test/royale/tests/ExpectBDDTests.as        | 59 +++++++++++++++
 8 files changed, 313 insertions(+), 9 deletions(-)
 copy frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/{assertEquals.as => assertMatch.as} (84%)
 copy frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/{assertLessThan.as => assertNotMatch.as} (86%)
 copy frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/{assertEquals.as => assertThrows.as} (83%)


[royale-asjs] 02/02: RoyaleUnit: assertThrows

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3938fcc4020a3897c4de3ed41b59c34388d9d6ad
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Dec 19 14:16:34 2022 -0800

    RoyaleUnit: assertThrows
---
 .../main/royale/org/apache/royale/test/Assert.as   | 42 ++++++++++++++++++++++
 .../org/apache/royale/test/asserts/assertThrows.as | 30 ++++++++++++++++
 .../royale/org/apache/royale/test/bdd/IExpect.as   | 14 ++++++++
 .../royale/org/apache/royale/test/bdd/expect.as    | 18 ++++++++++
 .../src/test/royale/tests/AssertTests.as           | 35 ++++++++++++++++++
 .../src/test/royale/tests/ExpectBDDTests.as        | 35 ++++++++++++++++++
 6 files changed, 174 insertions(+)

diff --git a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/Assert.as b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/Assert.as
index 44b2c563e5..0a59c54c14 100644
--- a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/Assert.as
+++ b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/Assert.as
@@ -241,6 +241,28 @@ package org.apache.royale.test
 			failMatch(actual, regExp, message);
 		}
 
+		/**
+		 * Asserts that the provided function throws.
+		 * 
+		 * <p>Equivalent to <code>[Test(expected="RangeError")]</code></p>
+		 */
+		public static function assertThrows(fn:Function, type:Class = null, message:String = null):void
+		{
+			try
+			{
+				fn();
+			}
+			catch(e:*)
+			{
+				if (type != null)
+				{
+					assertType(e, type, message);
+				}
+				return;
+			}
+			fail("expected function to throw");
+		}
+
 		/**
 		 * Fails.
 		 */
@@ -495,6 +517,26 @@ package org.apache.royale.test
 			}
 		}
 
+		/**
+		 * Fails if the provided function throws.
+		 */
+		public static function failThrows(fn:Function, type:Class = null, message:String = null):void
+		{
+			try
+			{
+				fn();
+			}
+			catch(e:*)
+			{
+				if (type != null && e is type)
+				{
+					fail("expected function not to throw type <" + type + ">");
+					return;
+				}
+				fail("expected function not to throw");
+			}
+		}
+
 		/**
 		 * @private
 		 */
diff --git a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/assertThrows.as b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/assertThrows.as
new file mode 100644
index 0000000000..0d94e0893e
--- /dev/null
+++ b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/assertThrows.as
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.royale.test.asserts
+{
+	import org.apache.royale.test.Assert;
+
+	/**
+	 * Alias for org.apache.royale.test.Assert assertThrows method
+	 */
+	public function assertThrows(actual:Function, type:Class = null, message:String = null):void
+	{
+		Assert.assertThrows(actual, type, message);
+	}
+}
\ No newline at end of file
diff --git a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/IExpect.as b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/IExpect.as
index 3df66d54eb..3ccc327057 100644
--- a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/IExpect.as
+++ b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/IExpect.as
@@ -181,6 +181,20 @@ package org.apache.royale.test.bdd
 		 */
 		function match(regExp:RegExp, message:String = null):IExpect;
 
+		/**
+		 * Asserts that the provided function throws.
+		 * 
+		 * @see Assert#assertThrows
+		 */
+		function throw(type:Class = null, message:String = null):IExpect;
+
+		/**
+		 * Alias for <code>throw()</code>.
+		 * 
+		 * @see #throw
+		 */
+		function throws(type:Class = null, message:String = null):IExpect;
+
 		/**
 		 * Negates all assertions that follow in the chain.
 		 */
diff --git a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/expect.as b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/expect.as
index 7ce214f377..9312ab0bc4 100644
--- a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/expect.as
+++ b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/expect.as
@@ -212,6 +212,24 @@ class Expect implements IExpect
 		return this;
 	}
 
+	public function throw(type:Class = null, message:String = null):IExpect
+	{
+		if (_not)
+		{
+			Assert.failThrows(_value, type, message);
+		}
+		else
+		{
+			Assert.assertThrows(_value, type, message);
+		}
+		return this;
+	}
+
+	public function throws(type:Class = null, message:String = null):IExpect
+	{
+		return this.throw(type, message);
+	}
+
 	public function get not():IExpect
 	{
 		_not = !_not;
diff --git a/frameworks/projects/RoyaleUnit/src/test/royale/tests/AssertTests.as b/frameworks/projects/RoyaleUnit/src/test/royale/tests/AssertTests.as
index 386a4e76b2..72286d4aaa 100644
--- a/frameworks/projects/RoyaleUnit/src/test/royale/tests/AssertTests.as
+++ b/frameworks/projects/RoyaleUnit/src/test/royale/tests/AssertTests.as
@@ -979,6 +979,41 @@ package tests
 			Assert.assertNotMatch("123abc", /^[a-z]{3}\d{3}$/);
 		}
 
+		[Test]
+		public function testAssertThrowsNoType():void
+		{
+			Assert.assertThrows(function():void
+			{
+				throw new Error("I'm an error")
+			});
+		}
+
+		[Test]
+		public function testAssertThrowsMatchingType():void
+		{
+			Assert.assertThrows(function():void
+			{
+				throw new RangeError("I'm a RangeError")
+			}, RangeError);
+		}
+
+		[Test(expected="org.apache.royale.test.AssertionError")]
+		public function testAssertThrowsWrongType():void
+		{
+			Assert.assertThrows(function():void
+			{
+				throw new Error("I'm an error")
+			}, RangeError);
+		}
+
+		[Test(expected="org.apache.royale.test.AssertionError")]
+		public function testAssertThrowsWithoutThrow():void
+		{
+			Assert.assertThrows(function():void
+			{
+			});
+		}
+
 		[Test(expected="org.apache.royale.test.AssertionError")]
 		public function testFail():void
 		{
diff --git a/frameworks/projects/RoyaleUnit/src/test/royale/tests/ExpectBDDTests.as b/frameworks/projects/RoyaleUnit/src/test/royale/tests/ExpectBDDTests.as
index 80ff0af0b8..b8b00ed5d1 100644
--- a/frameworks/projects/RoyaleUnit/src/test/royale/tests/ExpectBDDTests.as
+++ b/frameworks/projects/RoyaleUnit/src/test/royale/tests/ExpectBDDTests.as
@@ -1758,6 +1758,41 @@ package tests
 		{
 			expect("123abc").not.to.match(/^[a-z]{3}\d{3}$/);
 		}
+
+		[Test]
+		public function testExpectThrowsNoType():void
+		{
+			expect(function():void
+			{
+				throw new Error("I'm an error")
+			}).throws();
+		}
+
+		[Test]
+		public function testAssertThrowsMatchingType():void
+		{
+			expect(function():void
+			{
+				throw new RangeError("I'm a RangeError")
+			}).throws(RangeError);
+		}
+
+		[Test(expected="org.apache.royale.test.AssertionError")]
+		public function testAssertThrowsWrongType():void
+		{
+			expect(function():void
+			{
+				throw new Error("I'm an error")
+			}).throws(RangeError);
+		}
+
+		[Test(expected="org.apache.royale.test.AssertionError")]
+		public function testAssertThrowsWithoutThrow():void
+		{
+			expect(function():void
+			{
+			}).throws();
+		}
 	}
 }
 


[royale-asjs] 01/02: RoyaleUnit: assertMatch and assertNotMatch

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f1f19edb315b214ae2e2b6fde73c08a111515310
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Dec 19 13:51:50 2022 -0800

    RoyaleUnit: assertMatch and assertNotMatch
---
 .../main/royale/org/apache/royale/test/Assert.as   | 42 ++++++++++++++++++++++
 .../org/apache/royale/test/asserts/assertMatch.as  | 30 ++++++++++++++++
 .../apache/royale/test/asserts/assertNotMatch.as   | 30 ++++++++++++++++
 .../royale/org/apache/royale/test/bdd/IExpect.as   | 37 +++++++++++++++++++
 .../royale/org/apache/royale/test/bdd/expect.as    | 33 +++++++++++++++++
 .../src/test/royale/tests/AssertTests.as           | 24 +++++++++++++
 .../src/test/royale/tests/ExpectBDDTests.as        | 24 +++++++++++++
 7 files changed, 220 insertions(+)

diff --git a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/Assert.as b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/Assert.as
index fb2eb6f67b..44b2c563e5 100644
--- a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/Assert.as
+++ b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/Assert.as
@@ -221,6 +221,26 @@ package org.apache.royale.test
 			failType(actual, type, message);
 		}
 
+		/**
+		 * Asserts that the provided value matches a regular expression.
+		 * Equivalent to testing the value in an
+		 * <code>if(regExp.test(value))</code> statement.
+		 */
+		public static function assertMatch(actual:String, regExp:RegExp, message:String = null):void
+		{
+			failNotMatch(actual, regExp, message);
+		}
+
+		/**
+		 * Asserts that the provided value does not match a regular expression.
+		 * Equivalent to testing the value in an
+		 * <code>if(!regExp.test(value))</code> statement.
+		 */
+		public static function assertNotMatch(actual:String, regExp:RegExp, message:String = null):void
+		{
+			failMatch(actual, regExp, message);
+		}
+
 		/**
 		 * Fails.
 		 */
@@ -453,6 +473,28 @@ package org.apache.royale.test
 			}
 		}
 
+		/**
+		 * Fails if the provided value matches a regular expression.
+		 */
+		public static function failMatch(actual:String, regExp:RegExp, message:String = null):void
+		{
+			if (regExp.test(actual))
+			{
+				failWithUserMessage("expected <" + actual + "> to match regular expression <" + regExp + ">", message);
+			}
+		}
+
+		/**
+		 * Fails if the provided value does not match a regular expression.
+		 */
+		public static function failNotMatch(actual:String, regExp:RegExp, message:String = null):void
+		{
+			if (!regExp.test(actual))
+			{
+				failWithUserMessage("expected <" + actual + "> not to match regular expression <" + regExp + ">", message);
+			}
+		}
+
 		/**
 		 * @private
 		 */
diff --git a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/assertMatch.as b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/assertMatch.as
new file mode 100644
index 0000000000..299425783d
--- /dev/null
+++ b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/assertMatch.as
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.royale.test.asserts
+{
+	import org.apache.royale.test.Assert;
+
+	/**
+	 * Alias for org.apache.royale.test.Assert assertMatch method
+	 */
+	public function assertMatch(value:String, regExp:RegExp, message:String = null):void
+	{
+		Assert.assertMatch(value, regExp, message);
+	}
+}
\ No newline at end of file
diff --git a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/assertNotMatch.as b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/assertNotMatch.as
new file mode 100644
index 0000000000..96c04c667a
--- /dev/null
+++ b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/asserts/assertNotMatch.as
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.royale.test.asserts
+{
+	import org.apache.royale.test.Assert;
+
+	/**
+	 * Alias for org.apache.royale.test.Assert assertNotMatch method
+	 */
+	public function assertNotMatch(value:String, regExp:RegExp, message:String = null):void
+	{
+		Assert.assertNotMatch(value, regExp, message);
+	}
+}
\ No newline at end of file
diff --git a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/IExpect.as b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/IExpect.as
index bf09eeb8d7..3df66d54eb 100644
--- a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/IExpect.as
+++ b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/IExpect.as
@@ -115,6 +115,13 @@ package org.apache.royale.test.bdd
 		 */
 		function lt(other:Number, message:String = null):IExpect;
 
+		/**
+		 * Alias for <code>lessThan()</code>.
+		 * 
+		 * @see #lessThan
+		 */
+		function below(other:Number, message:String = null):IExpect;
+
 		/**
 		 * Alias for <code>greaterThan()</code>.
 		 * 
@@ -122,6 +129,13 @@ package org.apache.royale.test.bdd
 		 */
 		function gt(other:Number, message:String = null):IExpect;
 
+		/**
+		 * Alias for <code>greaterThan()</code>.
+		 * 
+		 * @see #greaterThan
+		 */
+		function above(other:Number, message:String = null):IExpect;
+
 		/**
 		 * Alias for <code>lessThanOrEqual()</code>.
 		 * 
@@ -129,6 +143,13 @@ package org.apache.royale.test.bdd
 		 */
 		function lte(other:Number, message:String = null):IExpect;
 
+		/**
+		 * Alias for <code>lessThanOrEqual()</code>.
+		 * 
+		 * @see #lessThanOrEqual
+		 */
+		function most(other:Number, message:String = null):IExpect;
+
 		/**
 		 * Alias for <code>greaterThanOrEqual()</code>.
 		 * 
@@ -136,6 +157,13 @@ package org.apache.royale.test.bdd
 		 */
 		function gte(other:Number, message:String = null):IExpect;
 
+		/**
+		 * Alias for <code>greaterThanOrEqual()</code>.
+		 * 
+		 * @see #greaterThanOrEqual
+		 */
+		function least(other:Number, message:String = null):IExpect;
+
 		/**
 		 * Asserts that the provided value is of a type. Equivalent to testing
 		 * the value in an <code>if(value is type)</code> statement.
@@ -144,6 +172,15 @@ package org.apache.royale.test.bdd
 		 */
 		function type(type:Class, message:String = null):IExpect;
 
+		/**
+		 * Asserts that the provided value matches a regular expression.
+		 * Equivalent to testing the value in an
+		 * <code>if(regExp.test(value))</code> statement.
+		 * 
+		 * @see Assert#assertMatch
+		 */
+		function match(regExp:RegExp, message:String = null):IExpect;
+
 		/**
 		 * Negates all assertions that follow in the chain.
 		 */
diff --git a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/expect.as b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/expect.as
index 3b13369479..7ce214f377 100644
--- a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/expect.as
+++ b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/bdd/expect.as
@@ -151,21 +151,41 @@ class Expect implements IExpect
 		return lessThan(other, message);
 	}
 
+	public function below(other:Number, message:String = null):IExpect
+	{
+		return lessThan(other, message);
+	}
+
 	public function lte(other:Number, message:String = null):IExpect
 	{
 		return lessThanOrEqual(other, message);
 	}
 
+	public function most(other:Number, message:String = null):IExpect
+	{
+		return lessThanOrEqual(other, message);
+	}
+
 	public function gt(other:Number, message:String = null):IExpect
 	{
 		return greaterThan(other, message);
 	}
 
+	public function above(other:Number, message:String = null):IExpect
+	{
+		return greaterThan(other, message);
+	}
+
 	public function gte(other:Number, message:String = null):IExpect
 	{
 		return greaterThanOrEqual(other, message);
 	}
 
+	public function least(other:Number, message:String = null):IExpect
+	{
+		return greaterThanOrEqual(other, message);
+	}
+
 	public function type(type:Class, message:String = null):IExpect
 	{
 		if (_not)
@@ -179,6 +199,19 @@ class Expect implements IExpect
 		return this;
 	}
 
+	public function match(regExp:RegExp, message:String = null):IExpect
+	{
+		if (_not)
+		{
+			Assert.assertNotMatch(_value, regExp, message);
+		}
+		else
+		{
+			Assert.assertMatch(_value, regExp, message);
+		}
+		return this;
+	}
+
 	public function get not():IExpect
 	{
 		_not = !_not;
diff --git a/frameworks/projects/RoyaleUnit/src/test/royale/tests/AssertTests.as b/frameworks/projects/RoyaleUnit/src/test/royale/tests/AssertTests.as
index cb657febad..386a4e76b2 100644
--- a/frameworks/projects/RoyaleUnit/src/test/royale/tests/AssertTests.as
+++ b/frameworks/projects/RoyaleUnit/src/test/royale/tests/AssertTests.as
@@ -955,6 +955,30 @@ package tests
 			Assert.assertNotType(obj, AssertTypeSubClass);
 		}
 
+		[Test]
+		public function testAssertMatchSuccess():void
+		{
+			Assert.assertMatch("abc123", /^[a-z]{3}\d{3}$/);
+		}
+
+		[Test(expected="org.apache.royale.test.AssertionError")]
+		public function testAssertMatchFailure():void
+		{
+			Assert.assertMatch("123abc", /^[a-z]{3}\d{3}$/);
+		}
+
+		[Test(expected="org.apache.royale.test.AssertionError")]
+		public function testAssertNotMatchSuccess():void
+		{
+			Assert.assertNotMatch("abc123", /^[a-z]{3}\d{3}$/);
+		}
+
+		[Test]
+		public function testAssertNotMatchFailure():void
+		{
+			Assert.assertNotMatch("123abc", /^[a-z]{3}\d{3}$/);
+		}
+
 		[Test(expected="org.apache.royale.test.AssertionError")]
 		public function testFail():void
 		{
diff --git a/frameworks/projects/RoyaleUnit/src/test/royale/tests/ExpectBDDTests.as b/frameworks/projects/RoyaleUnit/src/test/royale/tests/ExpectBDDTests.as
index 0bf42df96a..80ff0af0b8 100644
--- a/frameworks/projects/RoyaleUnit/src/test/royale/tests/ExpectBDDTests.as
+++ b/frameworks/projects/RoyaleUnit/src/test/royale/tests/ExpectBDDTests.as
@@ -1734,6 +1734,30 @@ package tests
 			var obj:ExpectTypeClass = new ExpectTypeClass();
 			expect(obj).is.not.type(ExpectTypeSubClass);
 		}
+
+		[Test]
+		public function testExpectMatchSuccess():void
+		{
+			expect("abc123").to.match(/^[a-z]{3}\d{3}$/);
+		}
+
+		[Test(expected="org.apache.royale.test.AssertionError")]
+		public function testExpectMatchFailure():void
+		{
+			expect("123abc").to.match(/^[a-z]{3}\d{3}$/);
+		}
+
+		[Test(expected="org.apache.royale.test.AssertionError")]
+		public function testExpectNotMatchSuccess():void
+		{
+			expect("abc123").not.to.match(/^[a-z]{3}\d{3}$/);
+		}
+
+		[Test]
+		public function testExpectNotMatchFailure():void
+		{
+			expect("123abc").not.to.match(/^[a-z]{3}\d{3}$/);
+		}
 	}
 }