diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-06-11 19:05:27 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-06-11 19:19:30 +0200 |
commit | 9590c87c623ba9654f332e26ba10370915e7ade9 (patch) | |
tree | ef6c2ea3474d8d7a42c172e9821f4c1abbf3b4d1 /deno2/mock_runtime_test.cc | |
parent | cbbe8ad9992765bc0883759e4075cf7a4a1918ff (diff) |
Add deno_dispose to tests.
And fix ArrayBuffer memory problem.
Diffstat (limited to 'deno2/mock_runtime_test.cc')
-rw-r--r-- | deno2/mock_runtime_test.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/deno2/mock_runtime_test.cc b/deno2/mock_runtime_test.cc index 00651f68e..22b596275 100644 --- a/deno2/mock_runtime_test.cc +++ b/deno2/mock_runtime_test.cc @@ -7,16 +7,19 @@ TEST(MockRuntimeTest, InitializesCorrectly) { Deno* d = deno_new(NULL, NULL); EXPECT_TRUE(deno_load(d, "a.js", "1 + 2")); + deno_dispose(d); } TEST(MockRuntimeTest, CanCallFoo) { Deno* d = deno_new(NULL, NULL); EXPECT_TRUE(deno_load(d, "a.js", "if (foo() != 'foo') throw Error();")); + deno_dispose(d); } TEST(MockRuntimeTest, ErrorsCorrectly) { Deno* d = deno_new(NULL, NULL); EXPECT_FALSE(deno_load(d, "a.js", "throw Error()")); + deno_dispose(d); } deno_buf strbuf(const char* str) { @@ -28,6 +31,7 @@ TEST(MockRuntimeTest, SendSuccess) { Deno* d = deno_new(NULL, NULL); EXPECT_TRUE(deno_load(d, "a.js", "recvabc();")); EXPECT_TRUE(deno_send(d, strbuf("abc"))); + deno_dispose(d); } TEST(MockRuntimeTest, SendByteLength) { @@ -35,12 +39,14 @@ TEST(MockRuntimeTest, SendByteLength) { EXPECT_TRUE(deno_load(d, "a.js", "recvabc();")); // We send the wrong sized message, it should throw. EXPECT_FALSE(deno_send(d, strbuf("abcd"))); + deno_dispose(d); } TEST(MockRuntimeTest, SendNoCallback) { Deno* d = deno_new(NULL, NULL); // We didn't call deno_recv(), sending should fail. EXPECT_FALSE(deno_send(d, strbuf("abc"))); + deno_dispose(d); } int main(int argc, char** argv) { |