Add tests for `valueOf`.

This commit is contained in:
David Wendt 2020-03-08 22:49:52 -04:00
parent b4d907bf2e
commit 03a240ebcd
13 changed files with 45 additions and 0 deletions

View File

@ -252,6 +252,9 @@ swf_tests! {
(as3_object_to_locale_string, "avm2/object_to_locale_string", 1),
(as3_function_to_locale_string, "avm2/function_to_locale_string", 1),
(as3_class_to_locale_string, "avm2/class_to_locale_string", 1),
(as3_object_value_of, "avm2/object_value_of", 1),
(as3_function_value_of, "avm2/function_value_of", 1),
(as3_class_value_of, "avm2/class_value_of", 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.valueOf() === ES4Class");
trace(ES4Class.valueOf() === ES4Class);

View File

@ -0,0 +1,2 @@
//ES4Class.valueOf() === ES4Class
true

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.valueOf() === freeFunction");
trace(freeFunction.valueOf() === freeFunction);
trace("//namedFunction.valueOf() === namedFunction");
trace(namedFunction.valueOf() === namedFunction);

View File

@ -0,0 +1,4 @@
//freeFunction.valueOf() === freeFunction
true
//namedFunction.valueOf() === namedFunction
true

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
package {
public class Test {}
}
var obj = new Object();
trace("//obj.valueOf() === obj");
trace(obj.valueOf() === obj);

View File

@ -0,0 +1,2 @@
//obj.valueOf() === obj
true

Binary file not shown.

Binary file not shown.