| 3112 | //=== Tap Reverse Binding ===================================================== |
| 3113 | |
| 3114 | struct Tap { |
| 3115 | explicit Tap(v8::Local<v8::Value> t) : t_() { |
| 3116 | HandleScope scope; |
| 3117 | |
| 3118 | t_.Reset(To<v8::Object>(t).ToLocalChecked()); |
| 3119 | } |
| 3120 | |
| 3121 | ~Tap() { t_.Reset(); } // not sure if necessary |
| 3122 | |
| 3123 | inline void plan(int i) { |
| 3124 | HandleScope scope; |
| 3125 | v8::Local<v8::Value> arg = New(i); |
| 3126 | Call("plan", New(t_), 1, &arg); |
| 3127 | } |
| 3128 | |
| 3129 | inline void ok(bool isOk, const char *msg = NULL) { |
| 3130 | HandleScope scope; |
| 3131 | v8::Local<v8::Value> args[2]; |
| 3132 | args[0] = New(isOk); |
| 3133 | if (msg) args[1] = New(msg).ToLocalChecked(); |
| 3134 | Call("ok", New(t_), msg ? 2 : 1, args); |
| 3135 | } |
| 3136 | |
| 3137 | inline void pass(const char * msg = NULL) { |
| 3138 | HandleScope scope; |
| 3139 | v8::Local<v8::Value> hmsg; |
| 3140 | if (msg) hmsg = New(msg).ToLocalChecked(); |
| 3141 | Call("pass", New(t_), msg ? 1 : 0, &hmsg); |
| 3142 | } |
| 3143 | |
| 3144 | inline void end() { |
| 3145 | HandleScope scope; |
| 3146 | Call("end", New(t_), 0, NULL); |
| 3147 | } |
| 3148 | |
| 3149 | private: |
| 3150 | Persistent<v8::Object> t_; |
| 3151 | }; |
| 3152 | |
| 3153 | #define NAN_STRINGIZE2(x) #x |
| 3154 | #define NAN_STRINGIZE(x) NAN_STRINGIZE2(x) |
nothing calls this directly
no outgoing calls
no test coverage detected