mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 20:04:59 +00:00
Tests: Port test-cpp-preprocessor to Core::Stream
This commit is contained in:
parent
5833c55389
commit
aca28f00de
1 changed files with 8 additions and 10 deletions
|
@ -6,22 +6,20 @@
|
||||||
|
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <LibCore/DirIterator.h>
|
#include <LibCore/DirIterator.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/Stream.h>
|
||||||
#include <LibCpp/Parser.h>
|
#include <LibCpp/Parser.h>
|
||||||
#include <LibTest/TestCase.h>
|
#include <LibTest/TestCase.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
constexpr char TESTS_ROOT_DIR[] = "/home/anon/cpp-tests/preprocessor";
|
constexpr char TESTS_ROOT_DIR[] = "/home/anon/cpp-tests/preprocessor";
|
||||||
|
|
||||||
static String read_all(const String& path)
|
static String read_all(String const& path)
|
||||||
{
|
{
|
||||||
auto result = Core::File::open(path, Core::OpenMode::ReadOnly);
|
auto file = MUST(Core::Stream::File::open(path, Core::Stream::OpenMode::Read));
|
||||||
VERIFY(!result.is_error());
|
auto file_size = MUST(file->size());
|
||||||
auto content = result.value()->read_all();
|
auto content = MUST(ByteBuffer::create_uninitialized(file_size));
|
||||||
return { reinterpret_cast<const char*>(content.data()), content.size() };
|
if (!file->read_or_error(content.bytes()))
|
||||||
|
VERIFY_NOT_REACHED();
|
||||||
|
return String { content.bytes() };
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(test_regression)
|
TEST_CASE(test_regression)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue