This is an automated email from the ASF dual-hosted git repository.
gregdove 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 3e133c3 Adding a try-catch test for scope variation (based on catch
scope).
3e133c3 is described below
commit 3e133c3450a99b58835810df63c9bb7ae7b9c8cd
Author: greg-dove <[email protected]>
AuthorDate: Tue Jan 4 15:43:40 2022 +1300
Adding a try-catch test for scope variation (based on catch scope).
---
.../language/LanguageTesterTestTryCatch.as | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git
a/frameworks/projects/Core/src/test/royale/flexUnitTests/language/LanguageTesterTestTryCatch.as
b/frameworks/projects/Core/src/test/royale/flexUnitTests/language/LanguageTesterTestTryCatch.as
index bcd066a..ec413b6 100644
---
a/frameworks/projects/Core/src/test/royale/flexUnitTests/language/LanguageTesterTestTryCatch.as
+++
b/frameworks/projects/Core/src/test/royale/flexUnitTests/language/LanguageTesterTestTryCatch.as
@@ -126,6 +126,26 @@ package flexUnitTests.language
}
[Test]
+ public function testScopeVariation():void
+ {
+ var e:String = 'test';
+ try{
+ throw new Error('blah')
+ } catch (e:Error) {
+ var s:String = 'string declaration';
+ //'e' inside the catch scope should refer to the Error instance
+ assertEquals(Error, e.constructor,'unexpected variable state');
+ //'e' inside the catch scope should refer to the Error instance
+ assertEquals('string declaration', s,'unexpected variable
state');
+ }
+ //'e' outside the catch scope should refer to the externally
declared String instance
+ assertEquals('test', e,'unexpected variable state');
+ //'s' outside the catch scope should refer to the internally
declared String instance
+ assertEquals('string declaration', s,'unexpected variable state');
+ }
+
+
+ [Test]
public function testMultiCatchA():void
{
try{