Skip to content

Commit 5ab3923

Browse files
committed
tests: Port Definitions/Variable AS3 tests from avmplus
These tests have been adapted from the avmplus repo. See https://github.com/adobe/avmplus/tree/858d034a3bd3a54d9b70909386435cf4aec81d21/test
1 parent 6f304e6 commit 5ab3923

File tree

117 files changed

+2756
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+2756
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
/* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5+
6+
package Package1
7+
{
8+
public class Class1
9+
{
10+
private var classItem1 = "Class1 var classItem1 set at creation time";
11+
}
12+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
/* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5+
6+
package Package1
7+
{
8+
public class Class2
9+
{
10+
public function getClass1ClassItem1()
11+
{
12+
var c1 = new Class1();
13+
return c1.classItem1;
14+
}
15+
}
16+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
package {import flash.display.MovieClip; public class Test extends MovieClip {}}
5+
6+
import Package1.*;
7+
import com.adobe.test.Assert;
8+
import com.adobe.test.Utils;
9+
10+
var c2:Class2 = new Class2();
11+
12+
13+
var thisError = "no error";
14+
try
15+
{
16+
c2.getClass1ClassItem1();
17+
}
18+
catch(err)
19+
{
20+
thisError = err.toString();
21+
}
22+
finally
23+
{
24+
Assert.expectEq("attempt to access private variable of Class1 in Class2", "ReferenceError: Error #1069", Utils.referenceError(thisError));
25+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<flex-config>
2+
<compiler>
3+
<source-path>
4+
<path-element>.</path-element>
5+
<path-element>../../../../lib</path-element>
6+
</source-path>
7+
<debug>false</debug>
8+
<omit-trace-statements>false</omit-trace-statements>
9+
<show-actionscript-warnings>false</show-actionscript-warnings>
10+
<strict>false</strict>
11+
</compiler>
12+
<output>test.swf</output>
13+
</flex-config>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
attempt to access private variable of Class1 in Class2 PASSED!
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
num_ticks = 1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
package Package1
5+
{
6+
public class Class1
7+
{
8+
public const classItem1 = "const Class1 classItem1 set at creation time";
9+
public const classItem2 = "const Class1 classItem2 set at creation time", classItem3, classItem4 = "const Class1 classItem4 set at creation time";
10+
public const classItem5:int = 6;
11+
public static const classItem6 = "static const Class1 classItem6 set at creation time";
12+
ns1 const classItem7:String = "ns1 const Class1 classItem7 set at creation time";
13+
ns1 static const classItem8:String = "ns1 static const Class1 classItem8 set at creation time";
14+
}
15+
16+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
package Package1
5+
{
6+
public class Class2
7+
{
8+
public const classItem1;
9+
public const classItem2, classItem3, classItem4;
10+
public const classItem5:int = 6;
11+
public static const classItem6 = init();
12+
ns1 const classItem7:String;
13+
ns1 static const classItem8:String = init2();
14+
15+
public function Class2()
16+
{
17+
classItem1 = "const Class2 classItem1 set in constructor";
18+
classItem2 = "const Class2 classItem2 set in constructor";
19+
classItem4 = "const Class2 classItem4 set in constructor";
20+
classItem5 = 7;
21+
ns1::classItem7 = "ns1 const Class2 classItem7 set in constructor";
22+
}
23+
24+
public static function init()
25+
{
26+
return "static const Class2 classItem6 set in function";
27+
}
28+
29+
public static function init2()
30+
{
31+
return "ns1 static const Class2 classItem8 set in function";
32+
}
33+
}
34+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
package Package1
5+
{
6+
public namespace ns1;
7+
}

0 commit comments

Comments
 (0)