GCC Code Coverage Report
Directory: ../src/ Exec Total Coverage
File: /home/node-core-coverage/node-core-coverage/workdir/node/out/../src/uv.cc Lines: 13 13 100.0 %
Date: 2016-12-18 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
116
void ErrName(const FunctionCallbackInfo<Value>& args) {
18
116
  Environment* env = Environment::GetCurrent(args);
19
116
  int err = args[0]->Int32Value();
20
116
  if (err >= 0)
21
    return env->ThrowError("err >= 0");
22
116
  const char* name = uv_err_name(err);
23
232
  args.GetReturnValue().Set(OneByteString(env->isolate(), name));
24
}
25
26
27
1727
void Initialize(Local<Object> target,
28
                Local<Value> unused,
29
                Local<Context> context) {
30
1727
  Environment* env = Environment::GetCurrent(context);
31
6908
  target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "errname"),
32
5181
              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
264231
  UV_ERRNO_MAP(V)
37
#undef V
38
1727
}
39
40
41
}  // namespace uv
42
}  // namespace node
43
44
1734
NODE_MODULE_CONTEXT_AWARE_BUILTIN(uv, node::uv::Initialize)