summaryrefslogtreecommitdiff
path: root/core/libdeno/modules_test.cc
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-04-08 10:12:43 -0400
committerGitHub <noreply@github.com>2019-04-08 10:12:43 -0400
commitf7fdb90fd51e340ea598c055bb3573d3cdfbdaa8 (patch)
tree40db117b3a9fd2ac70e3b5551195e21eef464138 /core/libdeno/modules_test.cc
parentcdb72afd8d91978573f0fa897844aee853983b44 (diff)
core: snapshot improvements (#2052)
* Moves how snapshots are supplied to the Isolate. Previously they were given by Behavior::startup_data() but it was only called once at startup. It makes more sense (and simplifies Behavior) to pass it to the constructor of Isolate. * Adds new libdeno type deno_snapshot instead of overloading deno_buf. * Adds new libdeno method to delete snapshot deno_snapshot_delete(). * Renames deno_get_snapshot() to deno_snapshot_new(). * Makes StartupData hold references to snapshots. This was implicit when it previously held a deno_buf but is made explicit now. Note that include_bytes!() returns a &'static [u8] and we want to avoid copying that.
Diffstat (limited to 'core/libdeno/modules_test.cc')
-rw-r--r--core/libdeno/modules_test.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/libdeno/modules_test.cc b/core/libdeno/modules_test.cc
index 9f9228430..0eaa9e8eb 100644
--- a/core/libdeno/modules_test.cc
+++ b/core/libdeno/modules_test.cc
@@ -13,7 +13,7 @@ void recv_cb(void* user_data, deno_buf buf, deno_buf zero_copy_buf) {
TEST(ModulesTest, Resolution) {
exec_count = 0; // Reset
- Deno* d = deno_new(deno_config{0, empty, empty, recv_cb});
+ Deno* d = deno_new(deno_config{0, empty_snapshot, empty, recv_cb});
EXPECT_EQ(0, exec_count);
static deno_mod a = deno_mod_new(d, true, "a.js",
@@ -66,7 +66,7 @@ TEST(ModulesTest, Resolution) {
TEST(ModulesTest, ResolutionError) {
exec_count = 0; // Reset
- Deno* d = deno_new(deno_config{0, empty, empty, recv_cb});
+ Deno* d = deno_new(deno_config{0, empty_snapshot, empty, recv_cb});
EXPECT_EQ(0, exec_count);
static deno_mod a = deno_mod_new(d, true, "a.js",
@@ -99,7 +99,7 @@ TEST(ModulesTest, ResolutionError) {
TEST(ModulesTest, ImportMetaUrl) {
exec_count = 0; // Reset
- Deno* d = deno_new(deno_config{0, empty, empty, recv_cb});
+ Deno* d = deno_new(deno_config{0, empty_snapshot, empty, recv_cb});
EXPECT_EQ(0, exec_count);
static deno_mod a =
@@ -119,7 +119,7 @@ TEST(ModulesTest, ImportMetaUrl) {
}
TEST(ModulesTest, ImportMetaMain) {
- Deno* d = deno_new(deno_config{0, empty, empty, recv_cb});
+ Deno* d = deno_new(deno_config{0, empty_snapshot, empty, recv_cb});
const char* throw_not_main_src = "if (!import.meta.main) throw 'err'";
static deno_mod throw_not_main =