diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-10-23 19:39:31 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-10-24 14:52:38 -0700 |
commit | fd68f85ce8cfbb036f0bc2c532f423d8ffa78289 (patch) | |
tree | dc6ed9f2fad00efdd5ae5468b4abf3631d54bd24 /libdeno/test.cc | |
parent | 3438dbe3509da8e8674dd803e8ecdc92e30f7d61 (diff) |
libdeno: deno_new should take a snapshot parameter.
Diffstat (limited to 'libdeno/test.cc')
-rw-r--r-- | libdeno/test.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libdeno/test.cc b/libdeno/test.cc index e97ba3f01..c178d109a 100644 --- a/libdeno/test.cc +++ b/libdeno/test.cc @@ -1,8 +1,20 @@ // Copyright 2018 the Deno authors. All rights reserved. MIT license. -#include "deno.h" -#include "testing/gtest/include/gtest/gtest.h" +#include "test.h" +#include "file_util.h" + +deno_buf snapshot = {nullptr, 0, nullptr, 0}; int main(int argc, char** argv) { + // Load the snapshot. + std::string contents; + if (!deno::ReadFileToString(SNAPSHOT_PATH, &contents)) { + printf("Failed to read file %s\n", SNAPSHOT_PATH); + return 1; + } + snapshot.data_ptr = + reinterpret_cast<uint8_t*>(const_cast<char*>(contents.c_str())); + snapshot.data_len = contents.size(); + testing::InitGoogleTest(&argc, argv); deno_init(); deno_set_v8_flags(&argc, argv); |