diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-10-24 01:12:13 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-10-24 14:52:38 -0700 |
commit | 61cda728816b5916180f22d977ba741e2fadc8d9 (patch) | |
tree | 99e77029d5f3ffafff7c8ca0136169abcdaf8f7f /libdeno/libdeno_test.cc | |
parent | 6afe94b3c855a8c486ce2a593cf2f8cac3b4d711 (diff) |
libdeno: Expose snapshot creation.
Diffstat (limited to 'libdeno/libdeno_test.cc')
-rw-r--r-- | libdeno/libdeno_test.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libdeno/libdeno_test.cc b/libdeno/libdeno_test.cc index 447012412..54285566f 100644 --- a/libdeno/libdeno_test.cc +++ b/libdeno/libdeno_test.cc @@ -16,6 +16,17 @@ TEST(LibDenoTest, InitializesCorrectlyWithoutSnapshot) { deno_delete(d); } +TEST(LibDenoTest, Snapshotter) { + Deno* d1 = deno_new_snapshotter(nullptr, "a.js", "a = 1 + 2", nullptr); + deno_buf test_snapshot = deno_get_snapshot(d1); + // TODO(ry) deno_delete(d1); + + Deno* d2 = deno_new(test_snapshot, nullptr); + EXPECT_TRUE( + deno_execute(d2, nullptr, "b.js", "if (a != 3) throw Error('x');")); + deno_delete(d2); +} + TEST(LibDenoTest, CanCallFunction) { Deno* d = deno_new(snapshot, nullptr); EXPECT_TRUE(deno_execute(d, nullptr, "a.js", |