LCOV - code coverage report
Current view: directory - js/src/jsapi-tests - testExtendedEq.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 12 12 100.0 %
Date: 2012-06-02 Functions: 9 7 77.8 %

       1                 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2                 :  * vim: set ts=8 sw=4 et tw=99:
       3                 :  *
       4                 :  * This tests user-specified (via JSExtendedClass) equality operations on
       5                 :  * trace.
       6                 :  */
       7                 : 
       8                 : #include "tests.h"
       9                 : #include "jsobj.h"
      10                 : 
      11                 : static JSBool
      12              10 : my_Equality(JSContext *cx, JSObject *obj, const jsval *, JSBool *bp)
      13                 : {
      14              10 :     *bp = JS_TRUE;
      15              10 :     return JS_TRUE;
      16                 : }
      17                 : 
      18                 : js::Class TestExtendedEq_JSClass = {
      19                 :     "TestExtendedEq",
      20                 :     0,
      21                 :     JS_PropertyStub,       /* addProperty */
      22                 :     JS_PropertyStub,       /* delProperty */
      23                 :     JS_PropertyStub,       /* getProperty */
      24                 :     JS_StrictPropertyStub, /* setProperty */
      25                 :     JS_EnumerateStub,
      26                 :     JS_ResolveStub,
      27                 :     NULL,                  /* convert */
      28                 :     NULL,                  /* finalize */
      29                 :     NULL,                  /* checkAccess */
      30                 :     NULL,                  /* call        */
      31                 :     NULL,                  /* construct   */
      32                 :     NULL,                  /* hasInstance */
      33                 :     NULL,                  /* mark        */
      34                 :     {
      35                 :         my_Equality,
      36                 :         NULL,              /* outerObject    */
      37                 :         NULL,              /* innerObject    */
      38                 :         NULL,              /* iteratorObject */
      39                 :         NULL,              /* wrappedObject  */
      40                 :     }
      41                 : };
      42                 : 
      43               4 : BEGIN_TEST(testExtendedEq_bug530489)
      44                 : {
      45               1 :     JSClass *clasp = (JSClass *) &TestExtendedEq_JSClass;
      46                 : 
      47               1 :     CHECK(JS_InitClass(cx, global, global, clasp, NULL, 0, NULL, NULL, NULL, NULL));
      48                 : 
      49               1 :     CHECK(JS_DefineObject(cx, global, "obj1", clasp, NULL, 0));
      50               1 :     CHECK(JS_DefineObject(cx, global, "obj2", clasp, NULL, 0));
      51                 : 
      52                 :     jsval v;
      53               1 :     EVAL("(function() { var r; for (var i = 0; i < 10; ++i) r = obj1 == obj2; return r; })()", &v);
      54               1 :     CHECK_SAME(v, JSVAL_TRUE);
      55               1 :     return true;
      56                 : }
      57               2 : END_TEST(testExtendedEq_bug530489)

Generated by: LCOV version 1.7