diff --git a/BUILD.gn b/BUILD.gn index 32d1b527c1..e989ed9086 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -161,7 +161,7 @@ static_library("libdeno") { configs += [ ":deno_config" ] } -# Only functionality needed for mock_runtime_test and snapshot_creator +# Only functionality needed for libdeno_test and snapshot_creator # In particular no flatbuffers, no assets, no rust, no msg handlers. # Because snapshots are slow, it's important that snapshot_creator's # dependencies are minimal. @@ -184,17 +184,17 @@ v8_source_set("deno_base_test") { sources = [ "src/file_util_test.cc", "src/from_snapshot.cc", - "src/mock_runtime_test.cc", + "src/libdeno_test.cc", ] inputs = [ - "$target_gen_dir/snapshot_mock_runtime.bin", + "$target_gen_dir/snapshot_libdeno_test.bin", ] deps = [ - ":create_snapshot_mock_runtime", + ":create_snapshot_libdeno_test", ":deno_base", "//testing/gtest:gtest", ] - defines = [ "DENO_MOCK_RUNTIME" ] + defines = [ "LIBDENO_TEST" ] configs = [ ":deno_config" ] } @@ -353,7 +353,7 @@ rust_flatbuffer("msg_rs") { ] } -# Generates $target_gen_dir/snapshot_deno.cc +# Generates $target_gen_dir/snapshot_deno.bin create_snapshot("deno") { js = "$target_gen_dir/bundle/main.js" source_map = "$target_gen_dir/bundle/main.js.map" @@ -362,8 +362,8 @@ create_snapshot("deno") { ] } -# Generates $target_gen_dir/snapshot_mock_runtime.cc -create_snapshot("mock_runtime") { +# Generates $target_gen_dir/snapshot_libdeno_test.bin +create_snapshot("libdeno_test") { testonly = true - js = "js/mock_runtime.js" + js = "js/libdeno_test.js" } diff --git a/js/mock_runtime.js b/js/libdeno_test.js similarity index 97% rename from js/mock_runtime.js rename to js/libdeno_test.js index 34f78479e2..10905494c6 100644 --- a/js/mock_runtime.js +++ b/js/libdeno_test.js @@ -1,12 +1,12 @@ // Copyright 2018 the Deno authors. All rights reserved. MIT license. // A simple runtime that doesn't involve typescript or protobufs to test -// libdeno. Invoked by mock_runtime_test.cc +// libdeno. Invoked by libdeno_test.cc const global = this; function assert(cond) { - if (!cond) throw Error("mock_runtime.js assert failed"); + if (!cond) throw Error("libdeno_test.js assert failed"); } global.CanCallFunction = () => { diff --git a/src/from_snapshot.cc b/src/from_snapshot.cc index 2575ec32f8..bcd215f820 100644 --- a/src/from_snapshot.cc +++ b/src/from_snapshot.cc @@ -12,9 +12,9 @@ extern const char deno_snapshot_start asm("deno_snapshot_start"); extern const char deno_snapshot_end asm("deno_snapshot_end"); -#ifdef DENO_MOCK_RUNTIME +#ifdef LIBDENO_TEST asm(".data\n" - "deno_snapshot_start: .incbin \"gen/snapshot_mock_runtime.bin\"\n" + "deno_snapshot_start: .incbin \"gen/snapshot_libdeno_test.bin\"\n" "deno_snapshot_end:\n" ".globl deno_snapshot_start;\n" ".globl deno_snapshot_end;"); @@ -24,7 +24,7 @@ asm(".data\n" "deno_snapshot_end:\n" ".globl deno_snapshot_start;\n" ".globl deno_snapshot_end;"); -#endif // DENO_MOCK_RUNTIME +#endif // LIBDENO_TEST namespace deno { diff --git a/src/mock_runtime_test.cc b/src/libdeno_test.cc similarity index 89% rename from src/mock_runtime_test.cc rename to src/libdeno_test.cc index ac50913deb..4675e4d7b2 100644 --- a/src/mock_runtime_test.cc +++ b/src/libdeno_test.cc @@ -3,20 +3,20 @@ #include "deno.h" -TEST(MockRuntimeTest, InitializesCorrectly) { +TEST(LibDenoTest, InitializesCorrectly) { Deno* d = deno_new(nullptr, nullptr); EXPECT_TRUE(deno_execute(d, "a.js", "1 + 2")); deno_delete(d); } -TEST(MockRuntimeTest, CanCallFunction) { +TEST(LibDenoTest, CanCallFunction) { Deno* d = deno_new(nullptr, nullptr); EXPECT_TRUE(deno_execute(d, "a.js", "if (CanCallFunction() != 'foo') throw Error();")); deno_delete(d); } -TEST(MockRuntimeTest, ErrorsCorrectly) { +TEST(LibDenoTest, ErrorsCorrectly) { Deno* d = deno_new(nullptr, nullptr); EXPECT_FALSE(deno_execute(d, "a.js", "throw Error()")); deno_delete(d); @@ -45,14 +45,14 @@ deno_buf StrBufNullAllocPtr(const char* str) { return buf; } -TEST(MockRuntimeTest, SendSuccess) { +TEST(LibDenoTest, SendSuccess) { Deno* d = deno_new(nullptr, nullptr); EXPECT_TRUE(deno_execute(d, "a.js", "SendSuccess()")); EXPECT_TRUE(deno_send(d, strbuf("abc"))); deno_delete(d); } -TEST(MockRuntimeTest, SendWrongByteLength) { +TEST(LibDenoTest, SendWrongByteLength) { Deno* d = deno_new(nullptr, nullptr); EXPECT_TRUE(deno_execute(d, "a.js", "SendWrongByteLength()")); // deno_send the wrong sized message, it should throw. @@ -63,14 +63,14 @@ TEST(MockRuntimeTest, SendWrongByteLength) { deno_delete(d); } -TEST(MockRuntimeTest, SendNoCallback) { +TEST(LibDenoTest, SendNoCallback) { Deno* d = deno_new(nullptr, nullptr); // We didn't call deno.recv() in JS, should fail. EXPECT_FALSE(deno_send(d, strbuf("abc"))); deno_delete(d); } -TEST(MockRuntimeTest, RecvReturnEmpty) { +TEST(LibDenoTest, RecvReturnEmpty) { static int count = 0; Deno* d = deno_new(nullptr, [](auto _, auto buf) { count++; @@ -84,7 +84,7 @@ TEST(MockRuntimeTest, RecvReturnEmpty) { deno_delete(d); } -TEST(MockRuntimeTest, RecvReturnBar) { +TEST(LibDenoTest, RecvReturnBar) { static int count = 0; Deno* d = deno_new(nullptr, [](auto deno, auto buf) { count++; @@ -99,13 +99,13 @@ TEST(MockRuntimeTest, RecvReturnBar) { deno_delete(d); } -TEST(MockRuntimeTest, DoubleRecvFails) { +TEST(LibDenoTest, DoubleRecvFails) { Deno* d = deno_new(nullptr, nullptr); EXPECT_FALSE(deno_execute(d, "a.js", "DoubleRecvFails()")); deno_delete(d); } -TEST(MockRuntimeTest, SendRecvSlice) { +TEST(LibDenoTest, SendRecvSlice) { static int count = 0; Deno* d = deno_new(nullptr, [](auto deno, auto buf) { static const size_t alloc_len = 1024; @@ -137,7 +137,7 @@ TEST(MockRuntimeTest, SendRecvSlice) { deno_delete(d); } -TEST(MockRuntimeTest, JSSendArrayBufferViewTypes) { +TEST(LibDenoTest, JSSendArrayBufferViewTypes) { static int count = 0; Deno* d = deno_new(nullptr, [](auto _, auto buf) { count++; @@ -152,7 +152,7 @@ TEST(MockRuntimeTest, JSSendArrayBufferViewTypes) { deno_delete(d); } -TEST(MockRuntimeTest, JSSendNeutersBuffer) { +TEST(LibDenoTest, JSSendNeutersBuffer) { static int count = 0; Deno* d = deno_new(nullptr, [](auto _, auto buf) { count++; @@ -164,19 +164,19 @@ TEST(MockRuntimeTest, JSSendNeutersBuffer) { deno_delete(d); } -TEST(MockRuntimeTest, TypedArraySnapshots) { +TEST(LibDenoTest, TypedArraySnapshots) { Deno* d = deno_new(nullptr, nullptr); EXPECT_TRUE(deno_execute(d, "a.js", "TypedArraySnapshots()")); deno_delete(d); } -TEST(MockRuntimeTest, SnapshotBug) { +TEST(LibDenoTest, SnapshotBug) { Deno* d = deno_new(nullptr, nullptr); EXPECT_TRUE(deno_execute(d, "a.js", "SnapshotBug()")); deno_delete(d); } -TEST(MockRuntimeTest, ErrorHandling) { +TEST(LibDenoTest, ErrorHandling) { static int count = 0; Deno* d = deno_new(nullptr, [](auto deno, auto buf) { count++; @@ -188,7 +188,7 @@ TEST(MockRuntimeTest, ErrorHandling) { deno_delete(d); } -TEST(MockRuntimeTest, SendNullAllocPtr) { +TEST(LibDenoTest, SendNullAllocPtr) { static int count = 0; Deno* d = deno_new(nullptr, [](auto _, auto buf) { count++; }); EXPECT_TRUE(deno_execute(d, "a.js", "SendNullAllocPtr()"));