From cfbd208fd3948402926795b289f01c111693874f Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Tue, 28 May 2024 15:53:42 +0700 Subject: [PATCH 1/3] docs(readme): add process execution assertion to key features --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cc59e52..2956b2a 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ A [CMake](https://cmake.org/) module containing a collection of assertion functi - Contains a collection of assertion functions for testing purposes. - Supports mocking and asserting the `message` function. +- Supports asserting process execution. ## Integration From 070340a1a1057fb514246a5a0afac9b83a1a48d5 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Tue, 28 May 2024 15:59:16 +0700 Subject: [PATCH 2/3] docs(readme): add assert process execution to example usages --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 2956b2a..9a99f6a 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,28 @@ assert_message(STATUS "some status message") assert_message(ERROR "some error message") ``` +### Assert Process Execution + +Use the `assert_execute_process` function to assert whether the given command successfully executed a process: + +```cmake +assert_execute_process(COMMAND "${CMAKE_COMMAND}" -E true) +``` + +This function can also assert the standard output and error of the executed process: + +```cmake +assert_execute_process( + COMMAND "${CMAKE_COMMAND}" -E echo "Hello world!" + OUTPUT "Hello world!" +) + +assert_execute_process( + COMMAND "${CMAKE_COMMAND}" invalid-dir + ERROR "CMake Error: The source directory .* does not exist." +) +``` + ## License This project is licensed under the terms of the [MIT License](./LICENSE). From 640d744e3b457f43b948937450cbe5e16804c40f Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Tue, 28 May 2024 16:01:36 +0700 Subject: [PATCH 3/3] chore: bump project to version 0.2.0 --- CMakeLists.txt | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ca2d9f..ad2f0e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.19) project( Assertion - VERSION 0.1.0 + VERSION 0.2.0 DESCRIPTION "A collection of assertion functions for testing purposes" HOMEPAGE_URL https://github.com/threeal/assertion-cmake LANGUAGES NONE diff --git a/README.md b/README.md index 9a99f6a..9c0b4f6 100644 --- a/README.md +++ b/README.md @@ -19,14 +19,14 @@ This module can be integrated into a CMake project in the following ways: - Use [`file(DOWNLOAD)`](https://cmake.org/cmake/help/latest/command/file.html#download) to automatically download the `Assertion.cmake` file: ```cmake file( - DOWNLOAD https://threeal.github.io/assertion-cmake/v0.1.0 + DOWNLOAD https://threeal.github.io/assertion-cmake/v0.2.0 ${CMAKE_BINARY_DIR}/Assertion.cmake ) include(${CMAKE_BINARY_DIR}/Assertion.cmake) ``` - Use [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) to add this package to the CMake project: ```cmake - cpmaddpackage(gh:threeal/assertion-cmake@0.1.0) + cpmaddpackage(gh:threeal/assertion-cmake@0.2.0) include(${Assertion_SOURCE_DIR}/cmake/Assertion.cmake) ```