From 0f148c8bcf4aba6bb561d16358419fd337ffcbbc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 2 Apr 2026 05:30:53 +0000 Subject: [PATCH 1/3] Initial plan From d8bcd7c8f9ec6cad388e04c4e06c529f70b4d07a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 2 Apr 2026 05:31:32 +0000 Subject: [PATCH 2/3] fix: convert CRLF to LF in test/test/box_string.cpp Agent-Logs-Url: https://github.com/microsoft/cppwinrt/sessions/9b31d4ec-f1c5-4859-89a1-3249eb553c5c Co-authored-by: DefaultRyan <26174284+DefaultRyan@users.noreply.github.com> --- test/test/box_string.cpp | 106 +++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/test/test/box_string.cpp b/test/test/box_string.cpp index efff92160..7294eeb79 100644 --- a/test/test/box_string.cpp +++ b/test/test/box_string.cpp @@ -1,53 +1,53 @@ -#include "pch.h" - -TEST_CASE("box_string") -{ - // hstring - { - winrt::hstring value = L"hstring"; - auto boxed = winrt::box_value(value); - REQUIRE(winrt::unbox_value(boxed) == L"hstring"); - } - - // wchar_t const* (string literal) - { - auto boxed = winrt::box_value(L"literal"); - REQUIRE(winrt::unbox_value(boxed) == L"literal"); - } - - // std::wstring - { - std::wstring value = L"wstring"; - auto boxed = winrt::box_value(value); - REQUIRE(winrt::unbox_value(boxed) == L"wstring"); - } - - // std::wstring_view (null-terminated) - { - std::wstring_view value = L"view"; - auto boxed = winrt::box_value(value); - REQUIRE(winrt::unbox_value(boxed) == L"view"); - } - - // std::wstring_view (not null-terminated) - // Regression test for https://github.com/microsoft/cppwinrt/issues/1527 - { - std::wstring source = L"ABCDE"; - std::wstring_view value(source.data(), 3); // "ABC" - auto boxed = winrt::box_value(value); - REQUIRE(winrt::unbox_value(boxed) == L"ABC"); - } - - // Empty string - { - auto boxed = winrt::box_value(winrt::hstring{}); - REQUIRE(winrt::unbox_value(boxed) == L""); - } - - // Empty wstring_view - { - std::wstring_view value; - auto boxed = winrt::box_value(value); - REQUIRE(winrt::unbox_value(boxed) == L""); - } -} +#include "pch.h" + +TEST_CASE("box_string") +{ + // hstring + { + winrt::hstring value = L"hstring"; + auto boxed = winrt::box_value(value); + REQUIRE(winrt::unbox_value(boxed) == L"hstring"); + } + + // wchar_t const* (string literal) + { + auto boxed = winrt::box_value(L"literal"); + REQUIRE(winrt::unbox_value(boxed) == L"literal"); + } + + // std::wstring + { + std::wstring value = L"wstring"; + auto boxed = winrt::box_value(value); + REQUIRE(winrt::unbox_value(boxed) == L"wstring"); + } + + // std::wstring_view (null-terminated) + { + std::wstring_view value = L"view"; + auto boxed = winrt::box_value(value); + REQUIRE(winrt::unbox_value(boxed) == L"view"); + } + + // std::wstring_view (not null-terminated) + // Regression test for https://github.com/microsoft/cppwinrt/issues/1527 + { + std::wstring source = L"ABCDE"; + std::wstring_view value(source.data(), 3); // "ABC" + auto boxed = winrt::box_value(value); + REQUIRE(winrt::unbox_value(boxed) == L"ABC"); + } + + // Empty string + { + auto boxed = winrt::box_value(winrt::hstring{}); + REQUIRE(winrt::unbox_value(boxed) == L""); + } + + // Empty wstring_view + { + std::wstring_view value; + auto boxed = winrt::box_value(value); + REQUIRE(winrt::unbox_value(boxed) == L""); + } +} From cd81d46b1d77d904017bc860435a83537bc154ec Mon Sep 17 00:00:00 2001 From: Ryan Shepherd Date: Wed, 1 Apr 2026 23:34:02 -0700 Subject: [PATCH 3/3] Add workflow to check line endings in pull requests --- .github/workflows/check-line-endings.yml | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/check-line-endings.yml diff --git a/.github/workflows/check-line-endings.yml b/.github/workflows/check-line-endings.yml new file mode 100644 index 000000000..a0705cf58 --- /dev/null +++ b/.github/workflows/check-line-endings.yml @@ -0,0 +1,32 @@ +name: Check Line Endings + +on: + pull_request: + push: + branches: + - master + +jobs: + check-line-endings: + name: Enforce .gitattributes line endings + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Check for line ending violations + run: | + # Re-normalize all files according to .gitattributes + git add --renormalize . + + # Check if renormalization changed anything + if git diff --cached --name-only | grep -q .; then + echo "::error::The following files have line endings that don't match .gitattributes settings:" + git diff --cached --name-only + echo "" + echo "To fix, run:" + echo " git add --renormalize ." + echo " git commit -m 'Normalize line endings'" + exit 1 + fi + + echo "All files have correct line endings."