Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/run_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ jobs:
working-directory: ${{ github.workspace }}/build/test
run: ./yk_util_test --report_level=short

- uses: TheMrMilchmann/setup-msvc-dev@v3
if: matrix.os.name == 'windows'
with:
arch: x64

- name: Test (Windows)
if: matrix.os.name == 'windows'
working-directory: ${{ github.workspace }}/build/test/${{ matrix.build_type }}
Expand Down
13 changes: 13 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ if(BUILD_TESTING)
PRIVATE $<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -pedantic-errors>
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/W4 /permissive- /Zc:__cplusplus /Zc:preprocessor /sdl /utf-8>
)
if(MSVC)
target_compile_options(
yk_util_test
PUBLIC
/fsanitize=address /wd5072 # ASan intentionally enabled on Release
)
target_link_options(
yk_util_test
PUBLIC
/ignore:4302 # ASan intentionally enabled on Release
/INCREMENTAL:NO # required for ASan
)
endif()
target_link_options(yk_util_test PRIVATE ${YK_COMMON_FLAG})

if(NOT MSVC)
Expand Down
7 changes: 7 additions & 0 deletions test/colorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ BOOST_AUTO_TEST_CASE(colorize)
BOOST_CHECK_THROW(boost::ignore_unused(yk::colorize(yk::runtime_colorize("[bg:rgb(12,34,56)|bg:rgb(78,90,12)]foo"))), yk::colorize_error);

BOOST_TEST(yk::colorized_size("[red]foo") == 18);

// TODO
#if !defined(_MSC_VER)
static_assert(yk::colorize("[red]foo") == "\033[38;2;255;0;0mfoo");
#endif
}

BOOST_AUTO_TEST_CASE(format_colorize)
Expand Down Expand Up @@ -192,13 +196,16 @@ BOOST_AUTO_TEST_CASE(print)

BOOST_AUTO_TEST_CASE(fixed)
{
// TODO
#if !defined(_MSC_VER)
static constexpr yk::fixed_string str = "[red]foo";
static_assert(yk::colorized_size(str) == 18);
static_assert(yk::colorize(str) == "\033[38;2;255;0;0mfoo");
static_assert(std::string_view{ yk::static_colorize_string<str>::colorized } == "\033[38;2;255;0;0mfoo");
using namespace yk::colorize_literals;
const auto s = yk::colorize_format("[red]{}"_col, 42);
BOOST_TEST(s == "\033[38;2;255;0;0m42");
#endif
}

BOOST_AUTO_TEST_SUITE_END()