tests: Port avmplus es3 Type Conversions tests

This commit is contained in:
Nathan Adams 2023-07-31 14:46:58 +02:00 committed by Adrian Wielgosik
parent cdc8e65f0c
commit 01bacb51ba
45 changed files with 1011 additions and 0 deletions

View File

@ -0,0 +1,89 @@
/* 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 = "Types: Conversions";
// var VERSION = "as3";
// var TITLE = "type conversions";
// "string"
Assert.expectEq("String('string')", "string", String("string"));
Assert.expectEq("String('')", "", String(""));
Assert.expectEq("Number('string')", NaN, Number("string"));
Assert.expectEq("Number('')", 0, Number(""));
Assert.expectEq("int('string')", 0, int("string"));
Assert.expectEq("int('')", 0, int(""));
Assert.expectEq("uint('string')", 0, uint("string"));
Assert.expectEq("uint('')", 0, uint(""));
Assert.expectEq("Boolean('string')", true, Boolean("string"));
Assert.expectEq("Boolean('')", false, Boolean(""));
Assert.expectEq("Object('string')", "string", Object("string"));
Assert.expectEq("Object('')", "", Object(""));
// null
Assert.expectEq( "String(null)", "null", String(null));
Assert.expectEq( "Number(null)", +0, Number(null));
Assert.expectEq( "int(null)", +0, int(null));
Assert.expectEq( "uint(null)", +0, uint(null));
Assert.expectEq( "Boolean(null)", false, Boolean(null));
Assert.expectEq( "Object(null)", "[object Object]", Object(null)+"");
// undefined
Assert.expectEq( "String(undefined)", "undefined", String(undefined));
Assert.expectEq( "Number(undefined)", NaN, Number(undefined));
Assert.expectEq( "int(undefined)", +0, int(undefined));
Assert.expectEq( "uint(undefined)", +0, uint(undefined));
Assert.expectEq( "Boolean(undefined)", false, Boolean(undefined));
Assert.expectEq( "Object(undefined)", "[object Object]", Object(undefined)+"");
// true
Assert.expectEq( "String(true)", "true", String(true));
Assert.expectEq( "Number(true)", 1, Number(true));
Assert.expectEq( "int(true)", 1, int(true));
Assert.expectEq( "uint(true)", 1, uint(true));
Assert.expectEq( "Boolean(true)", true, Boolean(true));
Assert.expectEq( "Object(true)", true, Object(true));
// false
Assert.expectEq( "String(false)", "false", String(false));
Assert.expectEq( "Number(false)", +0, Number(false));
Assert.expectEq( "int(false)", +0, int(false));
Assert.expectEq( "uint(false)", +0, uint(false));
Assert.expectEq( "Boolean(false)", false, Boolean(false));
Assert.expectEq( "Object(false)", false, Object(false));
// 1.23
Assert.expectEq( "String(1.23)", "1.23", String(1.23));
Assert.expectEq( "Number(1.23)", 1.23, Number(1.23));
Assert.expectEq( "int(1.23)", 1, int(1.23));
Assert.expectEq( "uint(1.23)", 1, uint(1.23));
Assert.expectEq( "Boolean(1.23)", true, Boolean(1.23));
Assert.expectEq( "Object(1.23)", 1.23, Object(1.23));
// -1.23
Assert.expectEq( "String(-1.23)", "-1.23", String(-1.23));
Assert.expectEq( "Number(-1.23)", -1.23, Number(-1.23));
Assert.expectEq( "int(-1.23)", -1, int(-1.23));
Assert.expectEq( "uint(-1.23)", 4294967295, uint(-1.23));
Assert.expectEq( "Boolean(-1.23)", true, Boolean(-1.23));
Assert.expectEq( "Object(-1.23)", -1.23, Object(-1.23));
// NaN
Assert.expectEq( "String(NaN)", "NaN", String(NaN));
Assert.expectEq( "Number(NaN)", NaN, Number(NaN));
Assert.expectEq( "int(NaN)", +0, int(NaN));
Assert.expectEq( "uint(NaN)", +0, uint(NaN));
Assert.expectEq( "Boolean(NaN)", false, Boolean(NaN));
Assert.expectEq( "Object(NaN)", NaN, Object(NaN));

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,54 @@
String('string') PASSED!
String('') PASSED!
Number('string') PASSED!
Number('') PASSED!
int('string') PASSED!
int('') PASSED!
uint('string') PASSED!
uint('') PASSED!
Boolean('string') PASSED!
Boolean('') PASSED!
Object('string') PASSED!
Object('') PASSED!
String(null) PASSED!
Number(null) PASSED!
int(null) PASSED!
uint(null) PASSED!
Boolean(null) PASSED!
Object(null) PASSED!
String(undefined) PASSED!
Number(undefined) PASSED!
int(undefined) PASSED!
uint(undefined) PASSED!
Boolean(undefined) PASSED!
Object(undefined) PASSED!
String(true) PASSED!
Number(true) PASSED!
int(true) PASSED!
uint(true) PASSED!
Boolean(true) PASSED!
Object(true) PASSED!
String(false) PASSED!
Number(false) PASSED!
int(false) PASSED!
uint(false) PASSED!
Boolean(false) PASSED!
Object(false) PASSED!
String(1.23) PASSED!
Number(1.23) PASSED!
int(1.23) PASSED!
uint(1.23) PASSED!
Boolean(1.23) PASSED!
Object(1.23) PASSED!
String(-1.23) PASSED!
Number(-1.23) PASSED!
int(-1.23) PASSED!
uint(-1.23) PASSED!
Boolean(-1.23) PASSED!
Object(-1.23) PASSED!
String(NaN) PASSED!
Number(NaN) PASSED!
int(NaN) PASSED!
uint(NaN) PASSED!
Boolean(NaN) PASSED!
Object(NaN) PASSED!

View File

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

View File

@ -0,0 +1,82 @@
/* 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 = "Types: Conversions";
// var VERSION = "as3";
// var TITLE = "implicit type conversions";
// Value = 1.23
/*var thisError = "no exception thrown";
try{
var string:String = 1.23;
} catch (e0) {
thisError = e0.toString();
} finally {
Assert.expectEq( "var string:String = 1.23", "no exception thrown", Utils.typeError(thisError));
Assert.expectEq( "var string:String = 1.23", "1.23", string);
}*/
var string:String = 1.23;
Assert.expectEq( "var string:String = 1.23", "1.23", string);
var number:Number = 1.23;
Assert.expectEq("number:Number = 1.23", 1.23, number );
/*thisError = "no exception thrown";
try{
var myInt:int;
myInt = 1.23;
} catch(e1) {
thisError = e1.toString();
} finally {
Assert.expectEq("myInt:int = 1.23", "RangeError: Error #1061", Utils.rangeError(thisError) );
}
print(myInt);*/
var myInt:int= 1.23;
Assert.expectEq("myint:int = 1.23", 1, myInt );
/*thisError = "no exception thrown";
try{
var myUint:uint;
myUint = 1.23;
} catch(e2) {
thisError = e2.toString();
} finally {
Assert.expectEq("myUInt:uint = 1.23", "RangeError: Error #1061", Utils.rangeError(thisError) );
}*/
var myUint:uint;
myUint = 1.23;
Assert.expectEq("myUInt:uint = 1.23", 1, myUint);
/*thisError = "no exception thrown";
try{
var boolean:Boolean = 1.23;
} catch(e3) {
thisError = e3.toString();
} finally {
Assert.expectEq("boolean:Boolean = 1.23", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("boolean:Boolean = 1.23", true, boolean);
}*/
var boolean:Boolean = 1.23;
Assert.expectEq("boolean:Boolean = 1.23", true, boolean);
var object:Object = 1.23;
Assert.expectEq( "var object:Object = 1.23", 1.23, object);

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,6 @@
var string:String = 1.23 PASSED!
number:Number = 1.23 PASSED!
myint:int = 1.23 PASSED!
myUInt:uint = 1.23 PASSED!
boolean:Boolean = 1.23 PASSED!
var object:Object = 1.23 PASSED!

View File

@ -0,0 +1,2 @@
num_ticks = 1
known_failure = true

View File

@ -0,0 +1,74 @@
/* 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 = "Types: Conversions";
// var VERSION = "as3";
// var TITLE = "implicit type conversions";
// Value = false
var thisError = "no exception thrown";
try{
var string:String = false;
} catch (e0) {
thisError = e0.toString();
} finally {
Assert.expectEq("string:String = false", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("string:String = false", "false", string);
}
thisError = "no exception thrown";
try{
var number:Number = false;
} catch (e) {
thisError = e.toString();
} finally {
Assert.expectEq("number:Number = false", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("number:Number = false", 0, number );
}
thisError = "no exception thrown";
try{
var myInt:int = false;
} catch(e1) {
thisError = e1.toString();
} finally {
Assert.expectEq("myInt:int = false", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myInt:int = false", 0, myInt );
}
thisError = "no exception thrown";
try{
var myUint:uint = false;
} catch(e2) {
thisError = e2.toString();
} finally {
Assert.expectEq("myUInt:uint = false", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myUInt:uint = false", 0, myUint );
}
thisError = "no exception thrown";
try{
var boolean:Boolean = false;
} catch(e3) {
thisError = e3.toString();
} finally {
Assert.expectEq("boolean:Boolean = false", "no exception thrown", Utils.typeError(thisError) );
}
var object:Object = false;
Assert.expectEq( "var object:Object = false", false, object);

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,10 @@
string:String = false PASSED!
string:String = false PASSED!
number:Number = false PASSED!
number:Number = false PASSED!
myInt:int = false PASSED!
myInt:int = false PASSED!
myUInt:uint = false PASSED!
myUInt:uint = false PASSED!
boolean:Boolean = false PASSED!
var object:Object = false PASSED!

View File

@ -0,0 +1,2 @@
num_ticks = 1
known_failure = true

View File

@ -0,0 +1,82 @@
/* 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 = "Types: Conversions";
// var VERSION = "as3";
// var TITLE = "implicit type conversions";
// Value = NaN
/*var thisError = "no exception thrown";
try{
var string:String = NaN;
} catch (e0) {
thisError = e0.toString();
} finally {
Assert.expectEq( "var string:String = NaN", "no exception thrown", Utils.typeError(thisError));
Assert.expectEq( "var string:String = NaN", "NaN", string);
}*/
var string:String = NaN;
Assert.expectEq( "var string:String = NaN", "NaN", string);
var number:Number = NaN;
Assert.expectEq("number:Number = NaN", NaN, number );
/*thisError = "no exception thrown";
try{
var myInt:int = NaN;
} catch(e1) {
thisError = e1.toString();
} finally {
Assert.expectEq("myInt:int = NaN", "RangeError: Error #1061", Utils.rangeError(thisError) );
Assert.expectEq("myInt:int = NaN", 0, myInt );
}*/
var myInt:int = NaN;
Assert.expectEq("myInt:int = NaN", 0, myInt );
/*thisError = "no exception thrown";
try{
var myUint:uint = NaN;
} catch(e2) {
thisError = e2.toString();
} finally {
Assert.expectEq("myUInt:uint = NaN", "RangeError: Error #1061", Utils.rangeError(thisError) );
Assert.expectEq("myUInt:uint = NaN", 0, myUint );
}*/
var myUint:uint = NaN;
Assert.expectEq("myUInt:uint = NaN", 0, myUint );
/*thisError = "no exception thrown";
try{
var boolean:Boolean = NaN;
} catch(e3) {
thisError = e3.toString();
} finally {
Assert.expectEq("boolean:Boolean = NaN", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("boolean:Boolean = NaN", false, boolean );
}*/
var boolean:Boolean = NaN;
Assert.expectEq("boolean:Boolean = NaN", false, boolean );
var object:Object = NaN;
Assert.expectEq( "var object:Object = NaN", NaN, object);

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,6 @@
var string:String = NaN PASSED!
number:Number = NaN PASSED!
myInt:int = NaN PASSED!
myUInt:uint = NaN PASSED!
boolean:Boolean = NaN PASSED!
var object:Object = NaN PASSED!

View File

@ -0,0 +1,2 @@
num_ticks = 1
known_failure = true

View File

@ -0,0 +1,73 @@
/* 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 = "Types: Conversions";
// var VERSION = "as3";
// var TITLE = "implicit type conversions";
// Value = -1.23
var thisError = "no exception thrown";
try{
var string:String = -1.23;
} catch (e0) {
thisError = e0.toString();
} finally {
Assert.expectEq( "var string:String = -1.23", "no exception thrown", Utils.typeError(thisError));
Assert.expectEq( "var string:String = -1.23", "-1.23", string);
}
var number:Number = -1.23;
Assert.expectEq("number:Number = undefined", -1.23, number );
thisError = "no exception thrown";
try{
var myInt:int = -1.23;
} catch(e1) {
thisError = e1.toString();
} finally {
Assert.expectEq("myInt:int = -1.23", "no exception thrown", Utils.rangeError(thisError) );
Assert.expectEq("myInt:int = -1.23", -1, myInt );
}
thisError = "no exception thrown";
try{
var myUint:uint = -1.23;
} catch(e2) {
thisError = e2.toString();
} finally {
Assert.expectEq("myUInt:uint = -1.23", "no exception thrown", Utils.rangeError(thisError) );
Assert.expectEq("myUInt:uint = -1.23", 4294967295, myUint);
}
thisError = "no exception thrown";
try{
var boolean:Boolean = -1.23;
} catch(e3) {
thisError = e3.toString();
} finally {
Assert.expectEq("boolean:Boolean = -1.23", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("boolean:Boolean = -1.23", true, boolean );
}
var object:Object = -1.23;
Assert.expectEq( "var object:Object = -1.23", -1.23, object);

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,10 @@
var string:String = -1.23 PASSED!
var string:String = -1.23 PASSED!
number:Number = undefined PASSED!
myInt:int = -1.23 PASSED!
myInt:int = -1.23 PASSED!
myUInt:uint = -1.23 PASSED!
myUInt:uint = -1.23 PASSED!
boolean:Boolean = -1.23 PASSED!
boolean:Boolean = -1.23 PASSED!
var object:Object = -1.23 PASSED!

View File

@ -0,0 +1,2 @@
num_ticks = 1
known_failure = true

View File

@ -0,0 +1,68 @@
/* 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 = "Types: Conversions";
// var VERSION = "as3";
// var TITLE = "implicit type conversions";
// Value = null
var string:String = null;
Assert.expectEq( "var string:String =null", null, string );
var thisError = "no exception thrown";
try{
var mynumber:Number = null;
} catch (e) {
thisError = e.toString();
} finally {
Assert.expectEq("number:Number = null", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("number:Number = null", 0, mynumber);
}
thisError = "no exception thrown";
try{
var myInt:int = null;
} catch(e1) {
thisError = e1.toString();
} finally {
Assert.expectEq("myInt:int = null", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myInt:int = null", 0, myInt );
}
thisError = "no exception thrown";
try{
var myUint:uint = null;
} catch(e2) {
thisError = e2.toString();
} finally {
Assert.expectEq("myUInt:uint = null", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myUInt:uint = null", 0, myUint );
}
thisError = "no exception thrown";
try{
var myboolean:Boolean = null;
} catch(e3) {
thisError = e3.toString();
} finally {
Assert.expectEq("boolean:Boolean = null", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("boolean:Boolean = null", false, myboolean);
}
var object:Object = null;
Assert.expectEq( "var object:Object = null", null, object);

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,10 @@
var string:String =null PASSED!
number:Number = null PASSED!
number:Number = null PASSED!
myInt:int = null PASSED!
myInt:int = null PASSED!
myUInt:uint = null PASSED!
myUInt:uint = null PASSED!
boolean:Boolean = null PASSED!
boolean:Boolean = null PASSED!
var object:Object = null PASSED!

View File

@ -0,0 +1,2 @@
num_ticks = 1
known_failure = true

View File

@ -0,0 +1,122 @@
/* 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 = "Types: Conversions";
// var VERSION = "as3";
// var TITLE = "implicit type conversions";
// Value = "string"
var string:String = "string";
Assert.expectEq( "var string:String ='string'", "string", string );
var thisError = "no exception thrown";
try{
var number:Number = "string";
} catch (e) {
//print( "hello?" );
thisError = e.toString();
} finally {
Assert.expectEq("number:Number = 'string'", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("number:Number = 'string'", NaN, number );
}
thisError = "no exception thrown";
try{
var myInt:int = "string";
} catch(e1) {
thisError = e1.toString();
} finally {
Assert.expectEq("myInt:int = 'string'", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myInt:int = 'string'", 0, myInt );
}
thisError = "no exception thrown";
try{
var myUint:uint = "string";
} catch(e2) {
thisError = e2.toString();
} finally {
Assert.expectEq("myUInt:uint = 'string'", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myUInt:uint = 'string'", 0, myUint );
}
thisError = "no exception thrown";
try{
var boolean:Boolean = "string";
} catch(e3) {
thisError = e3.toString();
} finally {
Assert.expectEq("boolean:Boolean = 'string'", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("boolean:Boolean = 'string'", true, boolean );
}
var object:Object = "string";
Assert.expectEq( "var object:Object ='string'", "string", object);
// empty string conversions ---------------------------------------------------------------------
var emptyString:String = "";
Assert.expectEq( 'var string:String =""', "", emptyString );
thisError = "no exception thrown";
try{
var number:Number = "";
} catch (e) {
thisError = e.toString();
} finally {
Assert.expectEq("number:Number = ''", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("number:Number = ''", 0, number );
}
thisError = "no exception thrown";
try{
var myInt:int = "";
} catch(e1) {
thisError = e1.toString();
} finally {
Assert.expectEq("myInt:int = ''", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myInt:int = ''", 0, myInt );
}
thisError = "no exception thrown";
try{
var myUint:uint = "";
} catch(e2) {
thisError = e2.toString();
} finally {
Assert.expectEq("myUInt:uint = ''", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myUInt:uint = ''", 0, myUint );
}
thisError = "no exception thrown";
try{
var boolean:Boolean = "";
} catch(e3) {
thisError = e3.toString();
} finally {
Assert.expectEq("boolean:Boolean = ''", "no exception thrown", Utils.typeError(thisError) );
//Note that the boolean result for empty string is opposite a non-empty string
Assert.expectEq("boolean:Boolean = ''", false, boolean );
}
var object:Object = "";
Assert.expectEq( "var object:Object =''", "", object);

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,20 @@
var string:String ='string' PASSED!
number:Number = 'string' PASSED!
number:Number = 'string' PASSED!
myInt:int = 'string' PASSED!
myInt:int = 'string' PASSED!
myUInt:uint = 'string' PASSED!
myUInt:uint = 'string' PASSED!
boolean:Boolean = 'string' PASSED!
boolean:Boolean = 'string' PASSED!
var object:Object ='string' PASSED!
var string:String ="" PASSED!
number:Number = '' PASSED!
number:Number = '' PASSED!
myInt:int = '' PASSED!
myInt:int = '' PASSED!
myUInt:uint = '' PASSED!
myUInt:uint = '' PASSED!
boolean:Boolean = '' PASSED!
boolean:Boolean = '' PASSED!
var object:Object ='' PASSED!

View File

@ -0,0 +1,2 @@
num_ticks = 1
known_failure = true

View File

@ -0,0 +1,74 @@
/* 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 = "Types: Conversions";
// var VERSION = "as3";
// var TITLE = "implicit type conversions";
// Value = true
var thisError = "no exception thrown";
try{
var string:String = true;
} catch (e0) {
thisError = e0.toString();
} finally {
Assert.expectEq("string:String = true", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("string:String = true", "true", string);
}
thisError = "no exception thrown";
try{
var number:Number = true;
} catch (e) {
thisError = e.toString();
} finally {
Assert.expectEq("number:Number = true", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("number:Number = true", 1, number);
}
thisError = "no exception thrown";
try{
var myInt:int = true;
} catch(e1) {
thisError = e1.toString();
} finally {
Assert.expectEq("myInt:int = true", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myInt:int = true", 1, myInt);
}
thisError = "no exception thrown";
try{
var myUint:uint = true;
} catch(e2) {
thisError = e2.toString();
} finally {
Assert.expectEq("myUInt:uint = true", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myUInt:uint = true", 1, myUint);
}
thisError = "no exception thrown";
try{
var boolean:Boolean = true;
} catch(e3) {
thisError = e3.toString();
} finally {
Assert.expectEq("boolean:Boolean = true", "no exception thrown", Utils.typeError(thisError) );
}
var object:Object = true;
Assert.expectEq( "var object:Object = true", true, object);

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,10 @@
string:String = true PASSED!
string:String = true PASSED!
number:Number = true PASSED!
number:Number = true PASSED!
myInt:int = true PASSED!
myInt:int = true PASSED!
myUInt:uint = true PASSED!
myUInt:uint = true PASSED!
boolean:Boolean = true PASSED!
var object:Object = true PASSED!

View File

@ -0,0 +1,2 @@
num_ticks = 1
known_failure = true

View File

@ -0,0 +1,76 @@
/* 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 = "Types: Conversions";
// var VERSION = "as3";
// var TITLE = "implicit type conversions";
// Value = undefined
var thisError = "no exception thrown";
try{
var string:String = undefined;
} catch (e0) {
thisError = e0.toString();
} finally {
Assert.expectEq( "var string:String =null", "no exception thrown", Utils.typeError(thisError));
Assert.expectEq( "var string:String =null", null,string);
}
thisError = "no exception thrown";
try{
var mynumber:Number = undefined;
} catch (e) {
thisError = e.toString();
} finally {
Assert.expectEq("number:Number = undefined", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("number:Number = undefined", NaN, mynumber );
}
thisError = "no exception thrown";
try{
var myInt:int = undefined;
} catch(e1) {
thisError = e1.toString();
} finally {
Assert.expectEq("myInt:int = undefined", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myInt:int = undefined", 0, myInt );
}
thisError = "no exception thrown";
try{
var myUint:uint = undefined;
} catch(e2) {
thisError = e2.toString();
} finally {
Assert.expectEq("myUInt:uint = undefined", "no exception thrown", Utils.typeError(thisError));
Assert.expectEq("myUInt:uint = undefined", 0, myUint);
}
thisError = "no exception thrown";
try{
var myboolean:Boolean = undefined;
} catch(e3) {
thisError = e3.toString();
} finally {
Assert.expectEq("myboolean:Boolean = undefined", "no exception thrown", Utils.typeError(thisError) );
Assert.expectEq("myboolean:Boolean = undefined", false, myboolean);
}
var object:Object = undefined;
Assert.expectEq( "var object:Object = null", null, object);

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,11 @@
var string:String =null PASSED!
var string:String =null PASSED!
number:Number = undefined PASSED!
number:Number = undefined PASSED!
myInt:int = undefined PASSED!
myInt:int = undefined PASSED!
myUInt:uint = undefined PASSED!
myUInt:uint = undefined PASSED!
myboolean:Boolean = undefined PASSED!
myboolean:Boolean = undefined PASSED!
var object:Object = null PASSED!

View File

@ -0,0 +1,2 @@
num_ticks = 1
known_failure = true