mirror of
https://github.com/nodejs/node.git
synced 2025-08-18 07:08:50 +02:00

PR-URL: https://github.com/nodejs/node/pull/49639 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
// Copyright 2016 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef V8_UNITTESTS_TEST_HELPERS_H_
|
|
#define V8_UNITTESTS_TEST_HELPERS_H_
|
|
|
|
#include <memory>
|
|
|
|
#include "include/v8-primitive.h"
|
|
#include "src/common/globals.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
class SharedFunctionInfo;
|
|
class Utf16CharacterStream;
|
|
|
|
namespace test {
|
|
|
|
class ScriptResource : public v8::String::ExternalOneByteStringResource {
|
|
public:
|
|
ScriptResource(const char* data, size_t length)
|
|
: data_(data), length_(length) {}
|
|
~ScriptResource() override = default;
|
|
ScriptResource(const ScriptResource&) = delete;
|
|
ScriptResource& operator=(const ScriptResource&) = delete;
|
|
|
|
const char* data() const override { return data_; }
|
|
size_t length() const override { return length_; }
|
|
|
|
private:
|
|
const char* data_;
|
|
size_t length_;
|
|
};
|
|
|
|
Handle<String> CreateSource(
|
|
Isolate* isolate,
|
|
v8::String::ExternalOneByteStringResource* maybe_resource);
|
|
Handle<SharedFunctionInfo> CreateSharedFunctionInfo(
|
|
Isolate* isolate,
|
|
v8::String::ExternalOneByteStringResource* maybe_resource);
|
|
std::unique_ptr<Utf16CharacterStream> SourceCharacterStreamForShared(
|
|
Isolate* isolate, Handle<SharedFunctionInfo> shared);
|
|
|
|
} // namespace test
|
|
} // namespace internal
|
|
} // namespace v8
|
|
|
|
#endif // V8_UNITTESTS_TEST_HELPERS_H_
|