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
22 changes: 12 additions & 10 deletions .github/workflows/msvc.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: MSVC Tests
name: CI Tests
on:
push:
pull_request:
branches:
- master

jobs:
test-cppwinrt:
test-msvc-cppwinrt:
name: 'MSVC: Tests'
strategy:
matrix:
arch: [x86, x64, arm64]
Expand All @@ -21,7 +22,7 @@ jobs:
- name: Test all
run: |
$VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat
if (!$VSDevCmd) { return 1 }
if (!$VSDevCmd) { exit 1 }
echo "Using VSDevCmd: ${VSDevCmd}"
cmd /c "${VSDevCmd}" "&" build_test_all.cmd ${{ matrix.arch }} ${{ matrix.config }}

Expand All @@ -37,30 +38,31 @@ jobs:
run: |
if (Test-Path "test_failures.txt") {
Get-Content "test_failures.txt" | ForEach-Object {
Write-Error "error: Test '$_' failed!"
echo "::error::Test '$_' failed!"
}
return 1
exit 1
}
if (!(Test-Path "*_results.txt")) {
Write-Error "error: No test output found!"
return 1
echo "::error::No test output found!"
exit 1
}

build-nuget:
name: Build nuget package with MSVC
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: Package
run: |
$VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat
if (!$VSDevCmd) { return 1 }
if (!$VSDevCmd) { exit 1 }
echo "Using VSDevCmd: ${VSDevCmd}"
cmd /c "${VSDevCmd}" "&" nuget.exe restore cppwinrt.sln
cmd /c "${VSDevCmd}" "&" build_nuget.cmd
if (!(Test-Path "*.nupkg")) {
Write-Error "error: Output nuget package not found!"
return 1
echo "::error::Output nuget package not found!"
exit 1
}

- name: Upload nuget package artifact
Expand Down
20 changes: 10 additions & 10 deletions test/old_tests/UnitTests/Errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ TEST_CASE("Errors")
try
{
init_apartment(apartment_type::single_threaded);
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_error const & e)
{
Expand All @@ -104,7 +104,7 @@ TEST_CASE("Errors")
try
{
Uri uri(L"BAD");
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_invalid_argument const & e) // catching specific exception type
{
Expand All @@ -115,7 +115,7 @@ TEST_CASE("Errors")
try
{
Uri uri(L"BAD");
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_error const& e)
{
Expand All @@ -128,7 +128,7 @@ TEST_CASE("Errors")
{
Errors errors;
errors.Propagate();
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_invalid_argument const & e) // catching specific exception type
{
Expand All @@ -140,7 +140,7 @@ TEST_CASE("Errors")
{
Errors errors;
errors.Fail(L"Failure message");
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_not_implemented const& e)
{
Expand All @@ -158,7 +158,7 @@ TEST_CASE("Errors")
{
Errors errors;
errors.std_out_of_range();
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_out_of_bounds const& e)
{
Expand All @@ -169,7 +169,7 @@ TEST_CASE("Errors")
{
Errors errors;
errors.std_invalid_argument();
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_invalid_argument const& e)
{
Expand All @@ -180,7 +180,7 @@ TEST_CASE("Errors")
{
Errors errors;
errors.std_exception();
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_error const& e)
{
Expand All @@ -207,7 +207,7 @@ TEST_CASE("Errors")
try
{
check_win32(ERROR_NO_NETWORK);
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_error const& e)
{
Expand All @@ -220,7 +220,7 @@ TEST_CASE("Errors")
try
{
check_nt(STATUS_STACK_OVERFLOW);
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_error const& e)
{
Expand Down
6 changes: 3 additions & 3 deletions test/old_tests/UnitTests/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ TEST_CASE("array,at,throw")
try
{
a.at(3);
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (std::out_of_range const & e)
{
Expand All @@ -357,7 +357,7 @@ TEST_CASE("array,at,throw")
try
{
test_array_ref_at_throw({ 1, 2, 3 });
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (std::out_of_range const & e)
{
Expand All @@ -372,7 +372,7 @@ TEST_CASE("array,at,throw")
try
{
a.at(5);
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (std::out_of_range const & e)
{
Expand Down
14 changes: 10 additions & 4 deletions test/old_tests/UnitTests/async.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ using namespace std::chrono;

namespace
{
#ifdef __cpp_lib_coroutine
using std::suspend_never;
#else
using std::experimental::suspend_never;
#endif

IAsyncAction NoSuspend_IAsyncAction()
{
co_await 0s;
Expand Down Expand Up @@ -1032,23 +1038,23 @@ namespace
{
signal_done d{ go };
co_await resume_on_signal(go);
co_await std::experimental::suspend_never{};
co_await suspend_never{};
REQUIRE(false);
}

IAsyncActionWithProgress<double> AutoCancel_IAsyncActionWithProgress(HANDLE go)
{
signal_done d{ go };
co_await resume_on_signal(go);
co_await std::experimental::suspend_never{};
co_await suspend_never{};
REQUIRE(false);
}

IAsyncOperation<uint32_t> AutoCancel_IAsyncOperation(HANDLE go)
{
signal_done d{ go };
co_await resume_on_signal(go);
co_await std::experimental::suspend_never{};
co_await suspend_never{};
REQUIRE(false);
co_return 0;
}
Expand All @@ -1057,7 +1063,7 @@ namespace
{
signal_done d{ go };
co_await resume_on_signal(go);
co_await std::experimental::suspend_never{};
co_await suspend_never{};
REQUIRE(false);
co_return 0;
}
Expand Down
18 changes: 9 additions & 9 deletions test/old_tests/UnitTests/hresult_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TEST_CASE("hresult,S_FALSE")
try
{
check_hresult(S_FALSE);
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_error const & e)
{
Expand All @@ -40,7 +40,7 @@ TEST_CASE("hresult,init_apartment")
try
{
init_apartment(apartment_type::single_threaded);
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_error const & e)
{
Expand All @@ -55,7 +55,7 @@ TEST_CASE("hresult,restricted,consuming")
try
{
Uri uri(L"BAD");
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_invalid_argument const & e) // catching specific exception type
{
Expand All @@ -66,7 +66,7 @@ TEST_CASE("hresult,restricted,consuming")
try
{
Uri uri(L"BAD");
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_error const & e) // catching generic exception type
{
Expand Down Expand Up @@ -501,7 +501,7 @@ TEST_CASE("hresult, std abi support")
};

handler(nullptr, 0);
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_error const& e)
{
Expand All @@ -517,7 +517,7 @@ TEST_CASE("hresult, std abi support")
};

handler(nullptr, 0);
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (std::bad_alloc const&)
{
Expand All @@ -531,7 +531,7 @@ TEST_CASE("hresult, std abi support")
};

handler(nullptr, 0);
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_out_of_bounds const& e)
{
Expand All @@ -547,7 +547,7 @@ TEST_CASE("hresult, std abi support")
};

handler(nullptr, 0);
FAIL(L"Previous line should throw");
FAIL("Previous line should throw");
}
catch (hresult_invalid_argument const& e)
{
Expand Down Expand Up @@ -575,4 +575,4 @@ TEST_CASE("hresult, to_message")
{
REQUIRE(to_message() == L"oh no, invalid handle");
}
}
}
16 changes: 11 additions & 5 deletions test/test/async_auto_cancel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,42 @@ using namespace Windows::Foundation;

namespace
{
#ifdef __cpp_lib_coroutine
using std::suspend_never;
#else
using std::experimental::suspend_never;
#endif

//
// Checks that the coroutine is automatically canceled when reaching a suspension point.
//

IAsyncAction Action(HANDLE event)
{
co_await resume_on_signal(event);
co_await std::experimental::suspend_never();
co_await suspend_never();
REQUIRE(false);
}

IAsyncActionWithProgress<int> ActionWithProgress(HANDLE event)
{
co_await resume_on_signal(event);
co_await std::experimental::suspend_never();
co_await suspend_never();
REQUIRE(false);
}

IAsyncOperation<int> Operation(HANDLE event)
{
co_await resume_on_signal(event);
co_await std::experimental::suspend_never();
co_await suspend_never();
REQUIRE(false);
co_return 1;
}

IAsyncOperationWithProgress<int, int> OperationWithProgress(HANDLE event)
{
co_await resume_on_signal(event);
co_await std::experimental::suspend_never();
co_await suspend_never();
REQUIRE(false);
co_return 1;
}
Expand All @@ -48,7 +54,7 @@ namespace
auto cancel = co_await get_cancellation_token();
cancel.callback(nullptr);

co_await std::experimental::suspend_never();
co_await suspend_never();
REQUIRE(false);
}

Expand Down
Loading