From 82605e2dff9380555fab587912300d127f5482c6 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Thu, 10 Mar 2022 14:02:40 +0000 Subject: [PATCH] Tests: Port TestHTMLTokenizer to Core::Stream --- Tests/LibWeb/TestHTMLTokenizer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Tests/LibWeb/TestHTMLTokenizer.cpp b/Tests/LibWeb/TestHTMLTokenizer.cpp index 67a34864d33..f44e2fe12c7 100644 --- a/Tests/LibWeb/TestHTMLTokenizer.cpp +++ b/Tests/LibWeb/TestHTMLTokenizer.cpp @@ -6,7 +6,7 @@ #include -#include +#include #include using Tokenizer = Web::HTML::HTMLTokenizer; @@ -201,9 +201,11 @@ TEST_CASE(doctype) // If that changes, or something is added to the test HTML, the hash needs to be adjusted. TEST_CASE(regression) { - auto file = Core::File::open("/usr/Tests/LibWeb/tokenizer-test.html", Core::OpenMode::ReadOnly); - VERIFY(!file.is_error()); - auto file_contents = file.value()->read_all(); + auto file = MUST(Core::Stream::File::open("/usr/Tests/LibWeb/tokenizer-test.html", Core::Stream::OpenMode::Read)); + auto file_size = MUST(file->size()); + auto content = MUST(ByteBuffer::create_uninitialized(file_size)); + MUST(file->read(content.bytes())); + String file_contents { content.bytes() }; auto tokens = run_tokenizer(file_contents); u32 hash = hash_tokens(tokens); EXPECT_EQ(hash, 710375345u);