mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
Userland: Adapt test-crypto to the new AK::Result API
This commit is contained in:
parent
72d56b46b5
commit
7384d58a0a
1 changed files with 12 additions and 3 deletions
|
@ -88,7 +88,11 @@ int run(Function<void(const char*, size_t)> fn)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
auto file = Core::File::open(filename, Core::IODevice::OpenMode::ReadOnly);
|
auto file = Core::File::open(filename, Core::IODevice::OpenMode::ReadOnly);
|
||||||
auto buffer = file->read_all();
|
if (file.is_error()) {
|
||||||
|
printf("That's a weird file man...\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
auto buffer = file.value()->read_all();
|
||||||
fn((const char*)buffer.data(), buffer.size());
|
fn((const char*)buffer.data(), buffer.size());
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1014,8 +1018,13 @@ void tls_test_client_hello()
|
||||||
tls->on_tls_finished = [&] {
|
tls->on_tls_finished = [&] {
|
||||||
PASS;
|
PASS;
|
||||||
auto file = Core::File::open("foo.response", Core::IODevice::WriteOnly);
|
auto file = Core::File::open("foo.response", Core::IODevice::WriteOnly);
|
||||||
file->write(contents);
|
if (file.is_error()) {
|
||||||
file->close();
|
printf("Can't write there, %s\n", file.error().characters());
|
||||||
|
loop.quit(2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
file.value()->write(contents);
|
||||||
|
file.value()->close();
|
||||||
loop.quit(0);
|
loop.quit(0);
|
||||||
};
|
};
|
||||||
tls->on_tls_error = [&](TLS::AlertDescription) {
|
tls->on_tls_error = [&](TLS::AlertDescription) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue