1
0
forked from Alepha/Alepha

A unix file descriptor streambuf for writing.

This commit is contained in:
2023-11-10 01:49:42 -05:00
parent 352bf22a68
commit e3ceed0233
4 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,28 @@
static_assert( __cplusplus > 2020'99 );
#include "../OutUnixFileBuf.h"
#include <Alepha/Testing/test.h>
#include <Alepha/AutoRAII.h>
#include <unistd.h>
#include <fcntl.h>
#include <Alepha/Utility/evaluation_helpers.h>
auto init= Alepha::Utility::enroll <=[]
{
using namespace Alepha::Testing::exports;
"Can we write to /dev/null?"_test <=[]
{
const auto fd= Alepha::AutoRAII
{
[]{ return open( "/dev/null", O_WRONLY ); },
::close
};
Alepha::IOStreams::OutUnixFileBuf buf{ fd };
std::ostream file{ &buf };
};
};

View File

@ -0,0 +1 @@
unit_test( 0 )