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

LCOV - code coverage report
| Current view: | directory - js/src/jsapi-tests - testBindCallable.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 13 | 13 | 100.0 %
| Date: | 2012-04-07 | Functions: | 8 | 6 | 75.0 %

           1                 : #include "tests.h"
           2                 :
           3               4 : BEGIN_TEST(test_BindCallable)
           4                 : {
           5                 :   jsval v;
           6               1 :   EVAL("({ somename : 1717 })", &v);
           7               1 :   CHECK(JSVAL_IS_OBJECT(v));
           8                 :
           9                 :   jsval func;
          10               1 :   EVAL("(function() { return this.somename; })", &func);
          11               1 :   CHECK(JSVAL_IS_OBJECT(func));
          12                 :
          13                 :   JSObject* newCallable = JS_BindCallable(cx, JSVAL_TO_OBJECT(func),
          14               1 :                                           JSVAL_TO_OBJECT(v));
          15               1 :   CHECK(newCallable);
          16                 :
          17                 :   jsval retval;
          18                 :   bool called = JS_CallFunctionValue(cx, NULL, OBJECT_TO_JSVAL(newCallable),
          19               1 :                                      0, NULL, &retval);
          20               1 :   CHECK(called);
          21                 :
          22               1 :   CHECK(JSVAL_IS_INT(retval));
          23                 :
          24               1 :   CHECK(JSVAL_TO_INT(retval) == 1717);
          25               1 :   return true;
          26                 : }
          27               2 : END_TEST(test_BindCallable)

Generated by: LCOV version 1.7