LCOV - app.info - js/src/jsapi-tests/testPropCache.cpp

LCOV - code coverage report
| Current view: | directory - js/src/jsapi-tests - testPropCache.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 11 | 11 | 100.0 %
| Date: | 2012-04-07 | 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                 :
           5                 : #include "tests.h"
           6                 :
           7                 : static int g_counter;
           8                 :
           9                 : static JSBool
          10               1 : CounterAdd(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
          11                 : {
          12               1 :     g_counter++;
          13               1 :     return JS_TRUE;
          14                 : }
          15                 :
          16                 : static JSClass CounterClass = {
          17                 :     "Counter",  /* name */
          18                 :     0,  /* flags */
          19                 :     CounterAdd, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
          20                 :     JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
          21                 : };
          22                 :
          23               4 : BEGIN_TEST(testPropCache_bug505798)
          24                 : {
          25               1 :     g_counter = 0;
          26               1 :     EXEC("var x = {};");
          27               1 :     CHECK(JS_DefineObject(cx, global, "y", &CounterClass, NULL, JSPROP_ENUMERATE));
          28               1 :     EXEC("var arr = [x, y];\n"
          29                 :          "for (var i = 0; i < arr.length; i++)\n"
          30                 :          "    arr[i].p = 1;\n");
          31               1 :     CHECK_EQUAL(g_counter, 1);
          32               1 :     return true;
          33                 : }
          34               2 : END_TEST(testPropCache_bug505798)

Generated by: LCOV version 1.7