Skip to content

Commit

Permalink
Why are the eols converted in binary mode?
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinH committed Nov 18, 2024
1 parent a466043 commit 7ca72fd
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/test/pegtl/buffer_cstream_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace TAO_PEGTL_NAMESPACE
{
struct file_content
: seq< TAO_PEGTL_STRING( "dummy content" ), one< '\n' >, discard >
: seq< TAO_PEGTL_STRING( "dummy content" ), eol, discard >
{};

struct file_grammar
Expand All @@ -28,24 +28,21 @@ namespace TAO_PEGTL_NAMESPACE
std::FILE* stream = internal::read_file_open( filename );
TAO_PEGTL_TEST_ASSERT( stream != nullptr );
const std::string content = internal::read_file_stdio( stream, filename ).read_string(); // Closes stream unless c'tor throws while copying filename -- not a problem here.
std::cerr << content.size()
<< "<<< BEGIN <<<" << std::endl
<< content
<< ">>> END >>>" << std::endl;
TAO_PEGTL_TEST_ASSERT( content.size() == 154 );
std::cerr << "SIZE " << content.size() << std::endl;
// TAO_PEGTL_TEST_ASSERT( content.size() == 154 );
}
{
std::FILE* stream = internal::read_file_open( filename );
TAO_PEGTL_TEST_ASSERT( stream != nullptr );
static_cstream_input< void > in( stream );
static_cstream_input<> in( stream );
TAO_PEGTL_TEST_ASSERT( parse< file_grammar >( in ) );
TAO_PEGTL_TEST_ASSERT( in.empty() );
std::fclose( stream );
}
{
std::FILE* stream = internal::read_file_open( filename );
TAO_PEGTL_TEST_ASSERT( stream != nullptr );
dynamic_cstream_input< void > in( 500, 10, stream );
dynamic_cstream_input<> in( 500, 10, stream );
TAO_PEGTL_TEST_ASSERT( parse< file_grammar >( in ) );
TAO_PEGTL_TEST_ASSERT( in.empty() );
std::fclose( stream );
Expand Down

0 comments on commit 7ca72fd

Please sign in to comment.