summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-07-23 14:10:48 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-07-24 12:29:54 -0400
commitb87e6d560477354e8c1b3c69e9836cd92eaf9984 (patch)
treea81b5637c85c30cffc76d9473287a2f2247376be /src
parent7baf8a0fd1ed1590ea00c4ab1412f29535cd68a5 (diff)
Add mock_runtime_test for deno_last_exception.
Diffstat (limited to 'src')
-rw-r--r--src/mock_runtime_test.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mock_runtime_test.cc b/src/mock_runtime_test.cc
index 971fa68f3..a2c4b3699 100644
--- a/src/mock_runtime_test.cc
+++ b/src/mock_runtime_test.cc
@@ -41,11 +41,14 @@ TEST(MockRuntimeTest, SendSuccess) {
deno_delete(d);
}
-TEST(MockRuntimeTest, SendByteLength) {
+TEST(MockRuntimeTest, SendWrongByteLength) {
Deno* d = deno_new(nullptr, nullptr);
- EXPECT_TRUE(deno_execute(d, "a.js", "SendByteLength()"));
- // We pub the wrong sized message, it should throw.
+ EXPECT_TRUE(deno_execute(d, "a.js", "SendWrongByteLength()"));
+ // deno_send the wrong sized message, it should throw.
EXPECT_FALSE(deno_send(d, strbuf("abcd")));
+ std::string exception = deno_last_exception(d);
+ EXPECT_GT(exception.length(), 1);
+ EXPECT_NE(exception.find("assert"), std::string::npos);
deno_delete(d);
}