From 2c30a25568b16c5f7cb288a14dbb0a2edf08cd5c Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 12 Jul 2018 13:41:19 -0400 Subject: [PATCH] Move C++ test main function to its own file. --- .travis.yml | 4 ++-- BUILD.gn | 3 ++- src/mock_runtime_test.cc | 7 ------- src/test.cc | 11 +++++++++++ 4 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 src/test.cc diff --git a/.travis.yml b/.travis.yml index d5e4af5d14..54b3f3bef7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,10 +42,10 @@ install: - gn args $BUILD_PATH --list - ccache -s # Travis hangs without -j2 argument to ninja. - - ninja -j2 -C $BUILD_PATH mock_runtime_test handlers_test deno_cc deno_cc_nosnapshot deno deno_nosnapshot + - ninja -j2 -C $BUILD_PATH test_cc handlers_test deno_cc deno_cc_nosnapshot deno deno_nosnapshot script: - ./tools/lint.py - - $BUILD_PATH/mock_runtime_test + - $BUILD_PATH/test_cc - $BUILD_PATH/handlers_test - $BUILD_PATH/deno_cc foo bar - $BUILD_PATH/deno_cc_nosnapshot foo bar diff --git a/BUILD.gn b/BUILD.gn index 488a983001..34c09b5824 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -72,13 +72,14 @@ executable("deno_cc_nosnapshot") { configs += [ ":deno_config" ] } -executable("mock_runtime_test") { +executable("test_cc") { testonly = true sources = [ "src/file_util_test.cc", "src/flatbuffer_builder_test.cc", "src/from_snapshot.cc", "src/mock_runtime_test.cc", + "src/test.cc", ] deps = [ ":create_snapshot_mock_runtime", diff --git a/src/mock_runtime_test.cc b/src/mock_runtime_test.cc index 19b2249501..ef4c1aaab6 100644 --- a/src/mock_runtime_test.cc +++ b/src/mock_runtime_test.cc @@ -174,10 +174,3 @@ TEST(MockRuntimeTest, ErrorHandling) { EXPECT_EQ(count, 1); deno_delete(d); } - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - deno_init(); - deno_set_flags(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/src/test.cc b/src/test.cc new file mode 100644 index 0000000000..d8b4380d72 --- /dev/null +++ b/src/test.cc @@ -0,0 +1,11 @@ +// Copyright 2018 Ryan Dahl +// All rights reserved. MIT License. +#include "deno.h" +#include "testing/gtest/include/gtest/gtest.h" + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + deno_init(); + deno_set_flags(&argc, argv); + return RUN_ALL_TESTS(); +}