#include "src/base/strings.h"
#include "src/heap/factory-inl.h"
#include "src/objects/objects-inl.h"
#include "src/parsing/scanner-character-streams.h"
#include "src/parsing/scanner.h"
#include "test/unittests/heap/heap-utils.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
using ScannerStreamsTest = v8::TestWithIsolate;
class ChunkSource : public v8::ScriptCompiler::ExternalSourceStream { … };
class LockChecker { … };
class TestExternalResource : public v8::String::ExternalStringResource,
public LockChecker { … };
class TestExternalOneByteResource
: public v8::String::ExternalOneByteStringResource,
public LockChecker { … };
const char unicode_utf8[] = …;
const uint16_t unicode_ucs2[] = …;
i::Handle<i::String> NewExternalTwoByteStringFromResource(
i::Isolate* isolate, TestExternalResource* resource) { … }
}
TEST_F(ScannerStreamsTest, Utf8StreamAsciiOnly) { … }
TEST_F(ScannerStreamsTest, Utf8StreamMaxNonSurrogateCharCode) { … }
TEST_F(ScannerStreamsTest, Utf8StreamBOM) { … }
TEST_F(ScannerStreamsTest, Utf8SplitBOM) { … }
TEST_F(ScannerStreamsTest, Utf8SplitMultiBOM) { … }
TEST_F(ScannerStreamsTest, Utf8AdvanceUntil) { … }
TEST_F(ScannerStreamsTest, AdvanceMatchAdvanceUntil) { … }
TEST_F(ScannerStreamsTest, Utf8AdvanceUntilOverChunkBoundaries) { … }
TEST_F(ScannerStreamsTest, Utf8ChunkBoundaries) { … }
TEST_F(ScannerStreamsTest, Utf8SingleByteChunks) { … }
#define CHECK_EQU …
void TestCharacterStream(const char* reference, i::Utf16CharacterStream* stream,
unsigned length, unsigned start, unsigned end) { … }
void TestCloneCharacterStream(const char* reference,
i::Utf16CharacterStream* stream,
unsigned length) { … }
#undef CHECK_EQU
void TestCharacterStreams(const char* one_byte_source, unsigned length,
unsigned start = 0, unsigned end = 0) { … }
TEST_F(ScannerStreamsTest, CharacterStreams) { … }
TEST_F(ScannerStreamsTest, Regress651333) { … }
void TestChunkStreamAgainstReference(
const char* cases[],
const std::vector<std::vector<uint16_t>>& unicode_expected) { … }
TEST_F(ScannerStreamsTest, Regress6377) { … }
TEST_F(ScannerStreamsTest, Regress6836) { … }
TEST_F(ScannerStreamsTest, TestOverlongAndInvalidSequences) { … }
TEST_F(ScannerStreamsTest, RelocatingCharacterStream) { … }
TEST_F(ScannerStreamsTest, RelocatingUnbufferedCharacterStream) { … }
TEST_F(ScannerStreamsTest, CloneCharacterStreams) { … }