Skip to content

Commit

Permalink
Move C++ test main function to its own file.
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Jul 13, 2018
1 parent 936c8f6 commit 2c30a25
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 0 additions & 7 deletions src/mock_runtime_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
11 changes: 11 additions & 0 deletions src/test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2018 Ryan Dahl <[email protected]>
// 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();
}

0 comments on commit 2c30a25

Please sign in to comment.