diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-03-10 14:02:40 +0000 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2022-03-10 12:04:22 -0500 |
commit | 82605e2dff9380555fab587912300d127f5482c6 (patch) | |
tree | c2d04a14a225efbc6661c8a20359d0dcfbf93d3b | |
parent | 2b2ddee77c99e23a5ed607a76901331bb1856437 (diff) | |
download | serenity-82605e2dff9380555fab587912300d127f5482c6.zip |
Tests: Port TestHTMLTokenizer to Core::Stream
-rw-r--r-- | Tests/LibWeb/TestHTMLTokenizer.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Tests/LibWeb/TestHTMLTokenizer.cpp b/Tests/LibWeb/TestHTMLTokenizer.cpp index 67a34864d3..f44e2fe12c 100644 --- a/Tests/LibWeb/TestHTMLTokenizer.cpp +++ b/Tests/LibWeb/TestHTMLTokenizer.cpp @@ -6,7 +6,7 @@ #include <LibTest/TestCase.h> -#include <LibCore/File.h> +#include <LibCore/Stream.h> #include <LibWeb/HTML/Parser/HTMLTokenizer.h> 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); |