Add tests for `toString` on objects, functions, and classes.

This commit is contained in:
David Wendt 2020-03-08 20:12:31 -04:00
parent f493cf954f
commit 37cdcb3bce
13 changed files with 43 additions and 0 deletions

View File

@ -244,6 +244,9 @@ swf_tests! {
(as3_has_own_property, "avm2/has_own_property", 1),
(as3_property_is_enumerable, "avm2/property_is_enumerable", 1),
(as3_set_property_is_enumerable, "avm2/set_property_is_enumerable", 1),
(as3_object_to_string, "avm2/object_to_string", 1),
(as3_function_to_string, "avm2/function_to_string", 1),
(as3_class_to_string, "avm2/class_to_string", 1),
}
// TODO: These tests have some inaccuracies currently, so we use approx_eq to test that numeric values are close enough.

View File

@ -0,0 +1,10 @@
package {
public class Test {}
}
class ES4Class {
}
trace("//ES4Class.toString()");
trace(ES4Class.toString());

View File

@ -0,0 +1,2 @@
//ES4Class.toString()
[class ES4Class]

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,16 @@
package {
public class Test {}
}
var freeFunction = function() {
};
function namedFunction() {
}
trace("//freeFunction.toString()");
trace(freeFunction.toString());
trace("//namedFunction.toString()");
trace(namedFunction.toString());

View File

@ -0,0 +1,4 @@
//freeFunction.toString()
function Function() {}
//namedFunction.toString()
function Function() {}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,6 @@
package {
public class Test {}
}
trace("//(new Object()).toString()");
trace((new Object()).toString());

View File

@ -0,0 +1,2 @@
//(new Object()).toString()
[object Object]

Binary file not shown.

Binary file not shown.