tests: Port avmplus es3 const tests

This commit is contained in:
Nathan Adams 2023-07-31 14:41:12 +02:00 committed by Adrian Wielgosik
parent c903c0081c
commit cdc8e65f0c
196 changed files with 1814 additions and 0 deletions

View File

@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
// var SECTION = "Directives\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "'const' outside a class access from inside the class"; // Provide ECMA section title or a description
var BUGNUMBER = "";
/*===========================================================================*/
const myConst = 50;
class ConstClass {
var myConstAdd = 20 + myConst;
}
var Obj = new ConstClass();
myObjConst = Obj.myConstAdd;
Assert.expectEq( "Testing the 'const' keywords access from an object of a class: var myConstAdd = 20 + myConst;", 70, myObjConst );
// This function is for executing the test case and then
// displaying the result on to the console or the LOG file.

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
Testing the 'const' keywords access from an object of a class: var myConstAdd = 20 + myConst; PASSED!

View File

@ -0,0 +1,34 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
// var SECTION = "Directives\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "'const' inside a class access from outside the class"; // Provide ECMA section title or a description
var BUGNUMBER = "";
/*===========================================================================*/
class ConstClass {
const myConst = 10;
}
var Obj = new ConstClass();
myObjConst = Obj.myConst;
Assert.expectEq( "Testing the 'const' keywords access from an object of a class: const myConst = 10;", 10, myObjConst );
// This function is for executing the test case and then
// displaying the result on to the console or the LOG file.

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
Testing the 'const' keywords access from an object of a class: const myConst = 10; PASSED!

View File

@ -0,0 +1,27 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip;
public class Test extends MovieClip {
const num1:Number = 1;
const num2:Number = 3;
public function getNumber(num1:Number, num2:Number)
{
return num1 + num2;
}
}
}
import com.adobe.test.Assert;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "const & class function arg with same name"; // Provide ECMA section title or a description
var BUGNUMBER = "";
var obj:Test = new Test();
Assert.expectEq("const and class function arg with same name. should return the sum of function arg", 2, obj.getNumber(1, 1));

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
const and class function arg with same name. should return the sum of function arg PASSED!

View File

@ -0,0 +1,28 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip;
public class Test extends MovieClip {
const num1:Number = 1;
const num2:Number = 3;
public function getNumber(num1:Number, num2:Number)
{
return this.num1 + this.num2;
}
}
}
import com.adobe.test.Assert;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "using const in package in a class"; // Provide ECMA section title or a description
var BUGNUMBER = "";
var obj:Test = new Test();
Assert.expectEq("const and class function arg with same name, access const with this. should return the sum of function arg", 4, obj.getNumber(1, 1));

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
const and class function arg with same name, access const with this. should return the sum of function arg PASSED!

View File

@ -0,0 +1,25 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "const & function arg with same name"; // Provide ECMA section title or a description
var BUGNUMBER = "";
const num1:Number = 1;
const num2:Number = 3;
function getNumber(num1:Number, num2:Number)
{
return num1 + num2;
}
Assert.expectEq("const and function arg with same name. should return the sum of function arg", 2, getNumber(1, 1));

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
const and function arg with same name. should return the sum of function arg PASSED!

View File

@ -0,0 +1,25 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "const & function arg with same name"; // Provide ECMA section title or a description
var BUGNUMBER = "";
const num1:Number = 1;
const num2:Number = 3;
function getNumber(num1:Number, num2:Number)
{
return this.num1 + this.num2;
}
Assert.expectEq("const and function arg share same name, access const with this. should return the sum of the two const", 4, getNumber(1, 1));

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
const and function arg share same name, access const with this. should return the sum of the two const PASSED!

View File

@ -0,0 +1,27 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "'const' as a subsitute for 'var'"; // Provide ECMA section title or a description
var BUGNUMBER = "";
/*===========================================================================*/
// Test case for checking the CONST keyword.
const myConstVar = 10;
Assert.expectEq( "const myConstVar = 10;", 10, myConstVar );
// This function is for executing the test case and then
// displaying the result on to the console or the LOG file.

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
const myConstVar = 10; PASSED!

View File

@ -0,0 +1,21 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "conditional initialization of const globally"; // Provide ECMA section title or a description
var BUGNUMBER = "";
var cond:Boolean = true;
const num1:Number = (cond)? 3 : 0;
Assert.expectEq("Conditional initiailization of const", 3, num1);

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
Conditional initiailization of const PASSED!

View File

@ -0,0 +1,32 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "conditional initialization inside class constructor"; // Provide ECMA section title or a description
var BUGNUMBER = "";
class MagicBall
{
const num1:Number;
function MagicBall(cond:Boolean)
{
num1 = (cond)? 6 : -8;
}
function getNumber():Number
{
return num1;
}
}
Assert.expectEq("Conditional initiailization of const inside a class constructor", -8, new MagicBall(false).getNumber());

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
Conditional initiailization of const inside a class constructor PASSED!

View File

@ -0,0 +1,39 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "conditional initialization inside class constructor"; // Provide ECMA section title or a description
var BUGNUMBER = "";
class MagicBall
{
const num1:Number;
function MagicBall(cond:Boolean)
{
if (cond)
{
num1 = 6;
}
else
{
num1 = -8;
}
}
function getNumber():Number
{
return num1;
}
}
Assert.expectEq("Conditional initiailization of const inside a class constructor", -8, new MagicBall(false).getNumber());

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
Conditional initiailization of const inside a class constructor PASSED!

View File

@ -0,0 +1,48 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
import com.adobe.test.Utils;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "conditional initialization inside class constructor"; // Provide ECMA section title or a description
var BUGNUMBER = "";
class MagicBall
{
const num1:Number;
function MagicBall(count:Number)
{
for (i=0; i<count; i++)
{
num1 ++;
}
}
function getNumber():Number
{
return num1;
}
}
var thisError:String = "no error";
try
{
var b:MagicBall = new MagicBall(3);
}
catch(err)
{
thisError = err.toString();
}
finally
{
Assert.expectEq("for loop for initializing const variable", "ReferenceError: Error #1074", Utils.referenceError(thisError));
}

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
for loop for initializing const variable PASSED!

View File

@ -0,0 +1,24 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "conditional initialization of const inside a function"; // Provide ECMA section title or a description
var BUGNUMBER = "";
function getNumber(cond:Boolean):Number
{
const num1:Number = (cond)? 3 : -3;
return num1;
}
Assert.expectEq("Conditional initiailization of const inside a function", -3, getNumber(false));

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
Conditional initiailization of const inside a function PASSED!

View File

@ -0,0 +1,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "const in package"; // Provide ECMA section title or a description
var BUGNUMBER = "";
import TestPackage.*;
import com.adobe.test.Assert;
Assert.expectEq("const in package", 3, num1 + num2);

View File

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package TestPackage
{
public const num1 = 1;
}

View File

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package TestPackage
{
public const num2 = 2;
}

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
const in package PASSED!

View File

@ -0,0 +1 @@
num_ticks = 1

View File

@ -0,0 +1,22 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "ambinuous reference to const in package"; // Provide ECMA section title or a description
var BUGNUMBER = "";
var num1 = 3;
var num2 = 4;
import TestPackage.*;
import com.adobe.test.Assert;
Assert.expectEq("const in package with fully qualified name", 3, TestPackage.num1 + TestPackage.num2);

View File

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package TestPackage
{
public const num1 = 1;
}

View File

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package TestPackage
{
public const num2 = 2;
}

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
const in package with fully qualified name PASSED!

View File

@ -0,0 +1 @@
num_ticks = 1

View File

@ -0,0 +1,21 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "using const in package in a class"; // Provide ECMA section title or a description
var BUGNUMBER = "";
import TestPackage.*;
import com.adobe.test.Assert;
var obj:TestClass = new TestClass();
Assert.expectEq("const in package with class", 3, obj.getNumber());

View File

@ -0,0 +1,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package TestPackage
{
public class TestClass
{
public function getNumber()
{
return num1 + num2;
}
}
}

View File

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package TestPackage
{
public const num1 = 1;
}

View File

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package TestPackage
{
public const num2 = 2;
}

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
const in package with class PASSED!

View File

@ -0,0 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "using const in package in a function"; // Provide ECMA section title or a description
var BUGNUMBER = "";
import TestPackage.*;
import com.adobe.test.Assert;
Assert.expectEq("const in package with function", 3, getNumber());

View File

@ -0,0 +1,10 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package TestPackage
{
public function getNumber()
{
return num1 + num2;
}
}

View File

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package TestPackage
{
public const num1 = 1;
}

View File

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package TestPackage
{
public const num2 = 2;
}

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
const in package with function PASSED!

View File

@ -0,0 +1,33 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "initialization of const inside function"; // Provide ECMA section title or a description
var BUGNUMBER = "";
class Person {
const name:String;
function Person(theName:String)
{
name = theName;
}
function getName():String
{
return name;
}
}
var bob:Person = new Person("bob");
Assert.expectEq("Initialize instance const inside constructor", "bob", bob.getName());

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
Initialize instance const inside constructor PASSED!

View File

@ -0,0 +1,41 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package {
import flash.display.MovieClip; public class Test extends MovieClip {}
}
import com.adobe.test.Assert;
import com.adobe.test.Utils;
// var SECTION = "Definitions\const"; // provide a document reference (ie, ECMA section)
// var VERSION = "ActionScript 3.0"; // Version of JavaScript or ECMA
// var TITLE = "Initialize a subclass instance const globally"; // Provide ECMA section title or a description
var BUGNUMBER = "";
class MyClass {
public const pubConst;
}
class MySubClass extends MyClass {}
var myConstObj = new MySubClass();
var thisError:String = "no error";
try
{
myConstObj.pubConst = -1;
}
catch(err)
{
thisError = err.toString();
}
finally
{
Assert.expectEq("Initialize a subclass instance const globally", "ReferenceError: Error #1074", Utils.referenceError(thisError));
}

View File

@ -0,0 +1,13 @@
<flex-config>
<compiler>
<source-path>
<path-element>.</path-element>
<path-element>../../../../lib</path-element>
</source-path>
<debug>false</debug>
<omit-trace-statements>false</omit-trace-statements>
<show-actionscript-warnings>false</show-actionscript-warnings>
<strict>false</strict>
</compiler>
<output>test.swf</output>
</flex-config>

View File

@ -0,0 +1 @@
Initialize a subclass instance const globally PASSED!

Some files were not shown because too many files have changed in this diff Show More