summaryrefslogtreecommitdiff
path: root/core/libdeno/test.cc
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-03-30 14:45:36 -0400
committerGitHub <noreply@github.com>2019-03-30 14:45:36 -0400
commitc9614d86c190b98bd8f0df9e17272387c3bad1d5 (patch)
tree68d9054cabb8a829beac72024d48c37f0fce7321 /core/libdeno/test.cc
parentad3cbc50fb255f287a890a28f158f6842d335538 (diff)
Move //libdeno to //core/libdeno (#2015)
Fixes some sed errors introduced in c43cfe. Unfortunately moving libdeno required splitting build.rs into two parts, one for cli and one for core. I've also removed the arm64 build - it's complicating things at this re-org and we're not even testing it. I need to swing back to it and get tools/test.py running for it.
Diffstat (limited to 'core/libdeno/test.cc')
-rw-r--r--core/libdeno/test.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/core/libdeno/test.cc b/core/libdeno/test.cc
new file mode 100644
index 000000000..1340fe8c3
--- /dev/null
+++ b/core/libdeno/test.cc
@@ -0,0 +1,31 @@
+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+#include "test.h"
+#include <string>
+#include "file_util.h"
+
+deno_buf snapshot = {nullptr, 0, nullptr, 0, 0};
+
+int main(int argc, char** argv) {
+ // Locate the snapshot.
+ std::string exe_path;
+ if (!deno::ExePath(&exe_path)) {
+ std::cerr << "deno::ExePath() failed" << std::endl;
+ return 1;
+ }
+ std::string snapshot_path = deno::Dirname(exe_path) + SNAPSHOT_PATH;
+
+ // Load the snapshot.
+ std::string contents;
+ if (!deno::ReadFileToString(snapshot_path.c_str(), &contents)) {
+ std::cerr << "Failed to read snapshot from " << snapshot_path << std::endl;
+ 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);
+ return RUN_ALL_TESTS();
+}