Bug 1114580 - Remove ctypes class tests. r=jorendorff
authorTom Schuster <evilpies@gmail.com>
Wed, 31 Aug 2016 00:13:10 +0200
changeset 311927 8c3d7a54cc162465ac9368c7809bcd6e219ceba6
parent 311926 b53afafbfb4325d8511e9de25d02df3943c3d73c
child 311928 6f03043a9f482a6f74947105e12ebc4bfdce444c
push id81239
push userevilpies@gmail.com
push dateTue, 30 Aug 2016 22:13:24 +0000
treeherdermozilla-inbound@8c3d7a54cc16 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1114580
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1114580 - Remove ctypes class tests. r=jorendorff
toolkit/components/ctypes/tests/unit/test_jsctypes.js
--- a/toolkit/components/ctypes/tests/unit/test_jsctypes.js
+++ b/toolkit/components/ctypes/tests/unit/test_jsctypes.js
@@ -30,24 +30,16 @@ function do_check_throws(f, type, stack)
       do_check_true(true);
       return;
     }
     do_throw("expected " + type.name + " exception, caught " + exc, stack);
   }
   do_throw("expected " + type.name + " exception, none thrown", stack);
 }
 
-function do_check_class(obj, classname, stack)
-{
-  if (!stack)
-    stack = Components.stack.caller;
-
-  do_check_eq(Object.prototype.toString.call(obj), "[object " + classname + "]", stack);
-}
-
 function run_test()
 {
   // Test ctypes.CType and ctypes.CData are set up correctly.
   run_abstract_class_tests();
 
   // open the library
   let libfile = do_get_file(CTYPES_TEST_LIB);
   let library = ctypes.open(libfile.path);
@@ -227,20 +219,16 @@ function run_test()
 }
 
 function run_abstract_class_tests()
 {
   // Test that ctypes.CType is an abstract constructor that throws.
   do_check_throws(function() { ctypes.CType(); }, TypeError);
   do_check_throws(function() { new ctypes.CType() }, TypeError);
 
-  // Test that classes and prototypes are set up correctly.
-  do_check_class(ctypes.CType, "Function");
-  do_check_class(ctypes.CType.prototype, "CType");
-
   do_check_true(ctypes.CType.hasOwnProperty("prototype"));
   do_check_throws(function() { ctypes.CType.prototype(); }, TypeError);
   do_check_throws(function() { new ctypes.CType.prototype() }, TypeError);
 
   do_check_true(ctypes.CType.prototype.hasOwnProperty("constructor"));
   do_check_true(ctypes.CType.prototype.constructor === ctypes.CType);
 
   // Check that ctypes.CType.prototype has the correct properties and functions.
@@ -265,20 +253,16 @@ function run_abstract_class_tests()
   // so we don't want them to throw.
   do_check_eq(typeof ctypes.CType.prototype.toString(), 'string');
   do_check_eq(typeof ctypes.CType.prototype.toSource(), 'string');
 
   // Test that ctypes.CData is an abstract constructor that throws.
   do_check_throws(function() { ctypes.CData(); }, TypeError);
   do_check_throws(function() { new ctypes.CData() }, TypeError);
 
-  // Test that classes and prototypes are set up correctly.
-  do_check_class(ctypes.CData, "Function");
-  do_check_class(ctypes.CData.prototype, "CData");
-
   do_check_true(ctypes.CData.__proto__ === ctypes.CType.prototype);
   do_check_true(ctypes.CData instanceof ctypes.CType);
 
   do_check_true(ctypes.CData.hasOwnProperty("prototype"));
   do_check_true(ctypes.CData.prototype.hasOwnProperty("constructor"));
   do_check_true(ctypes.CData.prototype.constructor === ctypes.CData);
 
   // Check that ctypes.CData.prototype has the correct properties and functions.
@@ -298,20 +282,16 @@ function run_abstract_class_tests()
   // so we don't want them to throw.
   do_check_eq(ctypes.CData.prototype.toString(), '[CData proto object]');
   do_check_eq(ctypes.CData.prototype.toSource(), '[CData proto object]');
 }
 
 function run_Int64_tests() {
   do_check_throws(function() { ctypes.Int64(); }, TypeError);
 
-  // Test that classes and prototypes are set up correctly.
-  do_check_class(ctypes.Int64, "Function");
-  do_check_class(ctypes.Int64.prototype, "Int64");
-
   do_check_true(ctypes.Int64.hasOwnProperty("prototype"));
   do_check_true(ctypes.Int64.prototype.hasOwnProperty("constructor"));
   do_check_true(ctypes.Int64.prototype.constructor === ctypes.Int64);
 
   // Check that ctypes.Int64 and ctypes.Int64.prototype have the correct
   // properties and functions.
   do_check_true(ctypes.Int64.hasOwnProperty("compare"));
   do_check_true(ctypes.Int64.hasOwnProperty("lo"));
@@ -472,20 +452,16 @@ function run_Int64_tests() {
   do_check_throws(function() { ctypes.Int64.join(0x80000000, 0); }, TypeError);
   do_check_throws(function() { ctypes.Int64.join(0, -0x1); }, TypeError);
   do_check_throws(function() { ctypes.Int64.join(0, 0x800000000); }, TypeError);
 }
 
 function run_UInt64_tests() {
   do_check_throws(function() { ctypes.UInt64(); }, TypeError);
 
-  // Test that classes and prototypes are set up correctly.
-  do_check_class(ctypes.UInt64, "Function");
-  do_check_class(ctypes.UInt64.prototype, "UInt64");
-
   do_check_true(ctypes.UInt64.hasOwnProperty("prototype"));
   do_check_true(ctypes.UInt64.prototype.hasOwnProperty("constructor"));
   do_check_true(ctypes.UInt64.prototype.constructor === ctypes.UInt64);
 
   // Check that ctypes.UInt64 and ctypes.UInt64.prototype have the correct
   // properties and functions.
   do_check_true(ctypes.UInt64.hasOwnProperty("compare"));
   do_check_true(ctypes.UInt64.hasOwnProperty("lo"));
@@ -741,20 +717,16 @@ function offsetof(struct, member) {
   while (memberptr != ptrValue(chararray.addressOfElement(offset)))
     ++offset;
   return offset;
 }
 
 // Test the class and prototype hierarchy for a given basic type 't'.
 function run_basic_class_tests(t)
 {
-  // Test that classes and prototypes are set up correctly.
-  do_check_class(t, "CType");
-  do_check_class(t.prototype, "CData");
-
   do_check_true(t.__proto__ === ctypes.CType.prototype);
   do_check_true(t instanceof ctypes.CType);
 
   do_check_true(t.prototype.__proto__ === ctypes.CData.prototype);
   do_check_true(t.prototype instanceof ctypes.CData);
   do_check_true(t.prototype.constructor === t);
 
   // Check that the shared properties and functions on 't.prototype' throw.
@@ -765,17 +737,16 @@ function run_basic_class_tests(t)
 
   // toString and toSource are called by the web console during inspection,
   // so we don't want them to throw.
   do_check_eq(t.prototype.toString(), '[CData proto object]');
   do_check_eq(t.prototype.toSource(), '[CData proto object]');
 
   // Test that an instance 'd' of 't' is a CData.
   let d = t();
-  do_check_class(d, "CData");
   do_check_true(d.__proto__ === t.prototype);
   do_check_true(d instanceof t);
   do_check_true(d.constructor === t);
 }
 
 function run_bool_tests(library) {
   let t = ctypes.bool;
   run_basic_class_tests(t);
@@ -1286,45 +1257,35 @@ function run_char16_tests(library, t, na
       [ 1, 1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1, 1,
         18 ] ]);
 }
 
 // Test the class and prototype hierarchy for a given type constructor 'c'.
 function run_type_ctor_class_tests(c, t, t2, props=[], fns=[], instanceProps=[], instanceFns=[], specialProps=[])
 {
-  // Test that classes and prototypes are set up correctly on the type ctor 'c'.
-  do_check_class(c, "Function");
-  do_check_class(c.prototype, "CType");
-
   do_check_true(c.prototype.__proto__ === ctypes.CType.prototype);
   do_check_true(c.prototype instanceof ctypes.CType);
   do_check_true(c.prototype.constructor === c);
 
   // Check that 'c.prototype' has the correct properties and functions.
   for (let p of props)
     do_check_true(c.prototype.hasOwnProperty(p));
   for (let f of fns)
     do_check_true(c.prototype.hasOwnProperty(f));
 
   // Check that the shared properties and functions on 'c.prototype' throw.
   for (let p of props)
     do_check_throws(function() { c.prototype[p]; }, TypeError);
   for (let f of fns)
     do_check_throws(function() { c.prototype[f](); }, TypeError);
 
-  // Test that classes and prototypes are set up correctly on a constructed
-  // type 't'.
-  do_check_class(t, "CType");
-  do_check_class(t.prototype, "CData");
-
   do_check_true(t.__proto__ === c.prototype);
   do_check_true(t instanceof c);
 
-  do_check_class(t.prototype.__proto__, "CData");
   // 't.prototype.__proto__' is the common ancestor of all types constructed
   // from 'c'; while not available from 'c' directly, it should be identically
   // equal to 't2.prototype.__proto__' where 't2' is a different CType
   // constructed from 'c'.
   do_check_true(t.prototype.__proto__ === t2.prototype.__proto__);
   if (t instanceof ctypes.FunctionType)
     do_check_true(t.prototype.__proto__.__proto__ === ctypes.PointerType.prototype.prototype);
   else
@@ -1362,17 +1323,16 @@ function run_type_ctor_class_tests(c, t,
   if (t instanceof ctypes.FunctionType)
     do_check_true(Object.getPrototypeOf(c.prototype.prototype) === ctypes.PointerType.prototype.prototype);
   else
     do_check_true(Object.getPrototypeOf(c.prototype.prototype) === ctypes.CType.prototype.prototype);
 
   // Test that an instance 'd' of 't' is a CData.
   if (t.__proto__ != ctypes.FunctionType.prototype) {
     let d = t();
-    do_check_class(d, "CData");
     do_check_true(d.__proto__ === t.prototype);
     do_check_true(d instanceof t);
     do_check_true(d.constructor === t);
   }
 }
 
 function run_StructType_tests() {
   run_type_ctor_class_tests(ctypes.StructType,