GCC Code Coverage Report
Directory: ../src/ Exec Total Coverage
File: /home/node-core-coverage/node-core-coverage/workdir/node/out/../src/node_config.cc Lines: 9 10 90.0 %
Date: 2017-01-02 Branches: 3 4 75.0 %

Line Branch Exec Source
1
#include "node.h"
2
#include "node_i18n.h"
3
#include "env.h"
4
#include "env-inl.h"
5
#include "util.h"
6
#include "util-inl.h"
7
8
9
namespace node {
10
11
using v8::Context;
12
using v8::Local;
13
using v8::Object;
14
using v8::ReadOnly;
15
using v8::Value;
16
17
// The config binding is used to provide an internal view of compile or runtime
18
// config options that are required internally by lib/*.js code. This is an
19
// alternative to dropping additional properties onto the process object as
20
// has been the practice previously in node.cc.
21
22
#define READONLY_BOOLEAN_PROPERTY(str)                                        \
23
  do {                                                                        \
24
    target->DefineOwnProperty(env->context(),                                 \
25
                              OneByteString(env->isolate(), str),             \
26
                              True(env->isolate()), ReadOnly).FromJust();     \
27
  } while (0)
28
29
1750
void InitConfig(Local<Object> target,
30
                Local<Value> unused,
31
                Local<Context> context) {
32
1750
  Environment* env = Environment::GetCurrent(context);
33
#ifdef NODE_HAVE_I18N_SUPPORT
34
35
10500
  READONLY_BOOLEAN_PROPERTY("hasIntl");
36
37
#ifdef NODE_HAVE_SMALL_ICU
38
10500
  READONLY_BOOLEAN_PROPERTY("hasSmallICU");
39
#endif  // NODE_HAVE_SMALL_ICU
40
41
1750
  if (flag_icu_data_dir)
42
    READONLY_BOOLEAN_PROPERTY("usingICUDataDir");
43
#endif  // NODE_HAVE_I18N_SUPPORT
44
45
1750
  if (config_preserve_symlinks)
46
24
    READONLY_BOOLEAN_PROPERTY("preserveSymlinks");
47
1750
}  // InitConfig
48
49
}  // namespace node
50
51
1757
NODE_MODULE_CONTEXT_AWARE_BUILTIN(config, node::InitConfig)