diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2018-08-26 16:57:16 +0900 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-08-26 11:03:41 -0400 |
commit | 17d6d6b336e48ab53ae1efa546df7c7b045152da (patch) | |
tree | 013b5fe136c93f7526e10b4b30d7fbab5ba910f8 /libdeno/libdeno_test.cc | |
parent | 3a5cf9ca8b6a4dae204139faff3f3bbad1f78b54 (diff) |
refactor: add and use libdeno.setGlobalErrorHandler instead of window.onerror
Diffstat (limited to 'libdeno/libdeno_test.cc')
-rw-r--r-- | libdeno/libdeno_test.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libdeno/libdeno_test.cc b/libdeno/libdeno_test.cc index 4675e4d7b..d3650788f 100644 --- a/libdeno/libdeno_test.cc +++ b/libdeno/libdeno_test.cc @@ -176,18 +176,24 @@ TEST(LibDenoTest, SnapshotBug) { deno_delete(d); } -TEST(LibDenoTest, ErrorHandling) { +TEST(LibDenoTest, GlobalErrorHandling) { static int count = 0; - Deno* d = deno_new(nullptr, [](auto deno, auto buf) { + Deno* d = deno_new(nullptr, [](auto _, auto buf) { count++; EXPECT_EQ(static_cast<size_t>(1), buf.data_len); EXPECT_EQ(buf.data_ptr[0], 42); }); - EXPECT_FALSE(deno_execute(d, "a.js", "ErrorHandling()")); + EXPECT_FALSE(deno_execute(d, "a.js", "GlobalErrorHandling()")); EXPECT_EQ(count, 1); deno_delete(d); } +TEST(LibDenoTest, DoubleGlobalErrorHandlingFails) { + Deno* d = deno_new(nullptr, nullptr); + EXPECT_FALSE(deno_execute(d, "a.js", "DoubleGlobalErrorHandlingFails()")); + deno_delete(d); +} + TEST(LibDenoTest, SendNullAllocPtr) { static int count = 0; Deno* d = deno_new(nullptr, [](auto _, auto buf) { count++; }); |