Skip to content

Commit cabda42

Browse files
tests: Add more tests for constructprop edge cases
Test for constructing an associated method and dynamic properties on a primitive class's prototype
1 parent 26250c6 commit cabda42

File tree

8 files changed

+77
-0
lines changed

8 files changed

+77
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package {
2+
import flash.display.MovieClip;
3+
4+
public class Test extends MovieClip {
5+
public function Test() {
6+
super();
7+
8+
Number.prototype.abc = 99;
9+
Number.prototype.def = new Function();
10+
Number.prototype.ghi = null;
11+
12+
var n:Number = 19;
13+
14+
try {
15+
new (n.abc)();
16+
trace("no error");
17+
} catch(e:Error) {
18+
trace(Object.prototype.toString.call(e));
19+
trace(e.errorID);
20+
}
21+
22+
try {
23+
new (n.def)();
24+
trace("no error");
25+
} catch(e:Error) {
26+
trace(Object.prototype.toString.call(e));
27+
trace(e.errorID);
28+
}
29+
30+
try {
31+
new (n.ghi)();
32+
trace("no error");
33+
} catch(e:Error) {
34+
trace(Object.prototype.toString.call(e));
35+
trace(e.errorID);
36+
}
37+
38+
try {
39+
new (n.jkl)();
40+
trace("no error");
41+
} catch(e:Error) {
42+
trace(Object.prototype.toString.call(e));
43+
trace(e.errorID);
44+
}
45+
}
46+
}
47+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[object TypeError]
2+
1007
3+
no error
4+
[object TypeError]
5+
1007
6+
[object TypeError]
7+
1007
657 Bytes
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
num_frames = 1
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package {
2+
import flash.display.MovieClip;
3+
4+
public class Test extends MovieClip {
5+
public function Test() {
6+
super();
7+
8+
try {
9+
new (this.abc)();
10+
} catch(e:Error) {
11+
trace(Object.prototype.toString.call(e));
12+
trace(e.errorID);
13+
}
14+
}
15+
16+
public function abc():void {
17+
}
18+
}
19+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[object TypeError]
2+
1064
537 Bytes
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
num_frames = 1

0 commit comments

Comments
 (0)