MCPcopy Create free account
hub / github.com/nodejs/nan / NAN_METHOD

Function NAN_METHOD

test/cpp/maybe.cpp:13–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11using namespace Nan; // NOLINT(build/namespaces)
12
13NAN_METHOD(Test) {
14 info.GetReturnValue().Set(false);
15 {
16 Maybe<int> mb = Nothing<int>();
17 if (mb.IsJust()) return;
18 if (!mb.IsNothing()) return;
19 if (mb.To(NULL)) return;
20 }
21 {
22 Maybe<int> mb = Just(42);
23 if (!mb.IsJust()) return;
24 if (mb.IsNothing()) return;
25 if (42 != mb.FromJust()) return;
26 if (42 != mb.ToChecked()) return;
27 mb.Check();
28 int v;
29 if (!mb.To(&v)) return;
30 if (42 != v) return;
31 }
32 info.GetReturnValue().Set(true);
33}
34
35NAN_MODULE_INIT(Init) {
36 SetMethod(target, "test", Test);

Callers

nothing calls this directly

Calls 9

JustFunction · 0.85
IsJustMethod · 0.80
IsNothingMethod · 0.80
ToMethod · 0.80
FromJustMethod · 0.80
ToCheckedMethod · 0.80
CheckMethod · 0.80
SetMethod · 0.45
GetReturnValueMethod · 0.45

Tested by

no test coverage detected