Skip to content

Commit 2f0ffbb

Browse files
committed
Merge pull request #204 from boostorg/test-iostream
2 parents b80e9d7 + 772df67 commit 2f0ffbb

5 files changed

Lines changed: 37 additions & 17 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ jobs:
2626
run: |
2727
echo "Running for $GITHUB_EVENT_NAME event"
2828
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
29-
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
29+
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
3030
else
3131
version=$(grep "set(_version " CMakeLists.txt | head -n1 | sed 's/^.* \([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')
32-
echo "::set-output name=tag::v$version"
32+
echo "tag=v$version" >> $GITHUB_OUTPUT
3333
fi
3434
- name: Sanity check version
3535
run: |

‎.github/workflows/update_standalone.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
# Check if anything changed to avoid later failure.
3333
# E.g. nothing changes if only CI files are modified which are removed by the above
3434
if git diff --exit-code; then
35-
echo "::set-output name=changed::false"
35+
echo "changed=false" >> $GITHUB_OUTPUT
3636
else
37-
echo "::set-output name=changed::true"
37+
echo "changed=true" >> $GITHUB_OUTPUT
3838
fi
3939
- name: Commit and push
4040
if: steps.standalone.outputs.changed == 'true'

‎doc/main.dox‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ If that happens unexpectatly watch the configuration check output for anything l
164164
This means your compiler doesn't use C++11 (or higher), e.g. because it defaults to C++03.
165165
You can pass `cxxstd=11` to `b2` to build in C++11 mode.
166166

167-
Experimental support for building with the Boost CMake build system is also available.
167+
Support for building with the Boost CMake build system is also available.
168168
For that run e.g. `cmake -DBOOST_INCLUDE_LIBRARIES=nowide <path-to-boost-root> <other options>`.
169169

170170
\subsection using_standard Standard Features

‎test/Jamfile.v2‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ run test_fstream.cpp file_test_helpers ;
4545
run test_fstream.cpp file_test_helpers : : : <define>BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT=1 <target-os>windows:<build>no : test_fstream_internal ;
4646
run test_fstream_special.cpp file_test_helpers ;
4747
run test_fstream_special.cpp file_test_helpers : : : <define>BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT=1 <target-os>windows:<build>no : test_fstream_special_internal ;
48-
run test_iostream.cpp file_test_helpers : : : <target-os>windows:<find-static-library>user32 ;
48+
run test_iostream.cpp file_test_helpers : : : <target-os>windows:<find-static-library>user32 <test-info>always_show_run_output ;
4949
if [ MATCH (--nowide-enable-cmake) : [ modules.peek : ARGV ] ]
5050
{
5151
# Use CMake as a cross-platform scripting language for this test

‎test/test_iostream.cpp‎

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2015 Artyom Beilis (Tonkikh)
2-
// Copyright (c) 2020 - 2021 Alexander Grund
2+
// Copyright (c) 2020 - 2026 Alexander Grund
33
//
44
// Distributed under the Boost Software License, Version 1.0.
55
// https://www.boost.org/LICENSE_1_0.txt
@@ -17,6 +17,7 @@
1717
#include "test.hpp"
1818
#include "test_sets.hpp"
1919
#include <algorithm>
20+
#include <cstdlib>
2021
#include <fstream>
2122
#include <limits>
2223
#include <queue>
@@ -457,10 +458,10 @@ class RedirectStdio
457458
void setBufferData(const std::wstring& data)
458459
{
459460
std::vector<INPUT_RECORD> buffer;
460-
buffer.reserve(data.size() * 2 + 2);
461+
buffer.reserve(data.size() * 2);
461462
for(const auto c : data)
462463
{
463-
INPUT_RECORD ev;
464+
INPUT_RECORD ev{};
464465
ev.EventType = KEY_EVENT;
465466
ev.Event.KeyEvent.bKeyDown = TRUE;
466467
ev.Event.KeyEvent.dwControlKeyState = 0;
@@ -472,14 +473,15 @@ class RedirectStdio
472473
} else
473474
{
474475
ev.Event.KeyEvent.uChar.UnicodeChar = c;
475-
ev.Event.KeyEvent.wVirtualKeyCode = VkKeyScanW(c);
476+
ev.Event.KeyEvent.wVirtualKeyCode = 0;
476477
}
477-
ev.Event.KeyEvent.wVirtualScanCode =
478-
static_cast<WORD>(MapVirtualKeyW(ev.Event.KeyEvent.wVirtualKeyCode, MAPVK_VK_TO_VSC));
478+
ev.Event.KeyEvent.wVirtualScanCode = 0;
479479
buffer.push_back(ev);
480480
ev.Event.KeyEvent.bKeyDown = FALSE;
481481
buffer.push_back(ev);
482482
}
483+
// Clear any previous contents
484+
FlushConsoleInputBuffer(h);
483485
DWORD dwWritten;
484486
TEST(WriteConsoleInputW(h, buffer.data(), static_cast<DWORD>(buffer.size()), &dwWritten));
485487
TEST_EQ(dwWritten, static_cast<DWORD>(buffer.size()));
@@ -489,6 +491,11 @@ class RedirectStdio
489491
void test_console()
490492
{
491493
#ifndef BOOST_NOWIDE_DISABLE_CIN_TEST
494+
#ifdef __MINGW32__
495+
bool isMinGW_CI = std::getenv("CI");
496+
#else
497+
bool isMinGW_CI = false;
498+
#endif
492499
std::cout << "Test cin console: " << std::flush;
493500
{
494501
RedirectStdio stdinHandle(STD_INPUT_HANDLE);
@@ -506,10 +513,20 @@ void test_console()
506513
std::string line;
507514
TEST(std::getline(cin, line));
508515
std::cout << "ASCII line read" << std::endl;
509-
TEST_EQ(line, testStringIn1);
510-
TEST(std::getline(cin, line));
511-
std::cout << "UTF-8 line read" << std::endl;
512-
TEST_EQ(line, testStringIn2);
516+
// MinGW on CI sometimes swallows the (mocked) first line or returns it multiple times
517+
if(isMinGW_CI && line == testStringIn2)
518+
std::cout << "WARNING: MinGW CI issue detected, skipping part of test"; // LCOV_EXCL_LINE
519+
else
520+
{
521+
TEST_EQ(line, testStringIn1);
522+
std::cout << "UTF-8 line read" << std::endl;
523+
line.clear();
524+
TEST(std::getline(cin, line));
525+
if(isMinGW_CI && line == testStringIn1)
526+
std::cout << "WARNING: MinGW CI issue detected, skipping 1st part of test"; // LCOV_EXCL_LINE
527+
else
528+
TEST_EQ(line, testStringIn2);
529+
}
513530
}
514531
#endif
515532
std::cout << "Test cout console" << std::endl;
@@ -523,7 +540,10 @@ void test_console()
523540
cout << testString << std::flush;
524541

525542
const auto data = stdoutHandle.getBufferData();
526-
TEST_EQ(data, nw::widen(testString));
543+
if(isMinGW_CI && data.empty())
544+
std::cout << "WARNING: MinGW CI issue detected, skipping part of test"; // LCOV_EXCL_LINE
545+
else
546+
TEST_EQ(data, nw::widen(testString));
527547
}
528548
std::cout << "Test cerr console" << std::endl;
529549
{

0 commit comments

Comments
 (0)