• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "node_native_module.h"
2 
3 #include "gtest/gtest.h"
4 #include "node_test_fixture.h"
5 
6 #include <string>
7 
8 
9 using node::native_module::NativeModuleLoader;
10 using node::native_module::NativeModuleRecordMap;
11 
12 class PerProcessTest : public ::testing::Test {
13  protected:
get_sources_for_test()14   static const NativeModuleRecordMap get_sources_for_test() {
15     return NativeModuleLoader::instance_.source_;
16   }
17 };
18 
19 namespace {
20 
TEST_F(PerProcessTest,EmbeddedSources)21 TEST_F(PerProcessTest, EmbeddedSources) {
22   const auto& sources = PerProcessTest::get_sources_for_test();
23   ASSERT_TRUE(
24     std::any_of(sources.cbegin(), sources.cend(),
25                 [](auto p){ return p.second.is_one_byte(); }))
26       << "NativeModuleLoader::source_ should have some 8bit items";
27 
28   ASSERT_TRUE(
29     std::any_of(sources.cbegin(), sources.cend(),
30                 [](auto p){ return !p.second.is_one_byte(); }))
31       << "NativeModuleLoader::source_ should have some 16bit items";
32 }
33 
34 }  // end namespace
35