From 7ca72fd0af437a3409979eb18ee39c929e113a59 Mon Sep 17 00:00:00 2001 From: "Dr. Colin Hirsch" Date: Mon, 18 Nov 2024 19:34:22 +0100 Subject: [PATCH] Why are the eols converted in binary mode? --- src/test/pegtl/buffer_cstream_input.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/test/pegtl/buffer_cstream_input.cpp b/src/test/pegtl/buffer_cstream_input.cpp index 4a78669e..1b99e4e2 100644 --- a/src/test/pegtl/buffer_cstream_input.cpp +++ b/src/test/pegtl/buffer_cstream_input.cpp @@ -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 @@ -28,16 +28,13 @@ 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 ); @@ -45,7 +42,7 @@ namespace TAO_PEGTL_NAMESPACE { 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 );