GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/node-core-coverage/node-core-coverage/workdir/node/out/../src/uv.cc Lines: 13 13 100.0 %
Date: 2016-09-05 Branches: 1 2 50.0 %

Line Branch Exec Source
1
#include "uv.h"
2
#include "node.h"
3
#include "env.h"
4
#include "env-inl.h"
5
6
namespace node {
7
namespace uv {
8
9
using v8::Context;
10
using v8::FunctionCallbackInfo;
11
using v8::Integer;
12
using v8::Local;
13
using v8::Object;
14
using v8::Value;
15
16
17
111
void ErrName(const FunctionCallbackInfo<Value>& args) {
18
111
  Environment* env = Environment::GetCurrent(args);
19
111
  int err = args[0]->Int32Value();
20
111
  if (err >= 0)
21
    return env->ThrowError("err >= 0");
22
111
  const char* name = uv_err_name(err);
23
222
  args.GetReturnValue().Set(OneByteString(env->isolate(), name));
24
}
25
26
27
1626
void Initialize(Local<Object> target,
28
                Local<Value> unused,
29
                Local<Context> context) {
30
1626
  Environment* env = Environment::GetCurrent(context);
31
6504
  target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "errname"),
32
4878
              env->NewFunctionTemplate(ErrName)->GetFunction());
33
#define V(name, _)                                                            \
34
  target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "UV_" # name),            \
35
              Integer::New(env->isolate(), UV_ ## name));
36
248778
  UV_ERRNO_MAP(V)
37
#undef V
38
1626
}
39
40
41
}  // namespace uv
42
}  // namespace node
43
44
1632
NODE_MODULE_CONTEXT_AWARE_BUILTIN(uv, node::uv::Initialize)