summaryrefslogtreecommitdiff
path: root/test/cctest
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2019-05-30 11:54:09 -0400
committerRich Trott <rtrott@gmail.com>2019-06-02 12:03:40 +0200
commitcb92d243e8b3603cf4abd231abe83179950927fc (patch)
tree33f4125357bb7dbd8efa85c32e0cdb71c2fcca04 /test/cctest
parentdb013e1cd3947ed0ae9dddaec127f1707e91a2ee (diff)
downloadnode-new-cb92d243e8b3603cf4abd231abe83179950927fc.tar.gz
tools: fix js2c regression
PR-URL: https://github.com/nodejs/node/pull/27980 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'test/cctest')
-rw-r--r--test/cctest/test_per_process.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/cctest/test_per_process.cc b/test/cctest/test_per_process.cc
new file mode 100644
index 0000000000..43af8dd65a
--- /dev/null
+++ b/test/cctest/test_per_process.cc
@@ -0,0 +1,34 @@
+#include "node_native_module.h"
+
+#include "gtest/gtest.h"
+#include "node_test_fixture.h"
+
+#include <string>
+
+
+using node::native_module::NativeModuleLoader;
+using node::native_module::NativeModuleRecordMap;
+
+class PerProcessTest : public ::testing::Test {
+ protected:
+ static const NativeModuleRecordMap get_sources_for_test() {
+ return NativeModuleLoader::instance_.source_;
+ }
+};
+
+namespace {
+
+TEST_F(PerProcessTest, EmbeddedSources) {
+ const auto& sources = PerProcessTest::get_sources_for_test();
+ ASSERT_TRUE(
+ std::any_of(sources.cbegin(), sources.cend(),
+ [](auto p){ return p.second.is_one_byte(); }))
+ << "NativeModuleLoader::source_ should have some 8bit items";
+
+ ASSERT_TRUE(
+ std::any_of(sources.cbegin(), sources.cend(),
+ [](auto p){ return !p.second.is_one_byte(); }))
+ << "NativeModuleLoader::source_ should have some 16bit items";
+}
+
+} // end namespace