-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: #1327 Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Michael Dawson <[email protected]
- Loading branch information
Showing
9 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "napi.h" | ||
#include "test_helper.h" | ||
|
||
#if (NAPI_VERSION > 8) | ||
|
||
using namespace Napi; | ||
|
||
namespace { | ||
|
||
Value GetModuleFileName(const CallbackInfo& info) { | ||
Env env = info.Env(); | ||
return String::New(env, env.GetModuleFileName()); | ||
} | ||
|
||
} // end anonymous namespace | ||
|
||
Object InitEnvMiscellaneous(Env env) { | ||
Object exports = Object::New(env); | ||
|
||
exports["get_module_file_name"] = Function::New(env, GetModuleFileName); | ||
|
||
return exports; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const { pathToFileURL } = require('url'); | ||
|
||
module.exports = require('./common').runTest(test); | ||
|
||
function test (binding, { bindingPath } = {}) { | ||
const path = binding.env_misc.get_module_file_name(); | ||
const bindingFileUrl = pathToFileURL(bindingPath).toString(); | ||
assert(bindingFileUrl === path); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters