├── .clang-format ├── .github └── workflows │ ├── build_and_test.yml │ └── release.yml ├── CMakeLists.txt ├── CMakePresets.json ├── LICENSE.md ├── README.md ├── doc └── lunchtoast.svg ├── external └── seal_lake ├── functional_tests ├── actions │ ├── actions.cfg │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ └── test.toast ├── actions_check_error_output │ ├── actions.cfg │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── actions_check_error_output_failed │ ├── actions.cfg │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── actions_check_exit_code │ ├── actions.cfg │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── actions_check_exit_code_failed │ ├── actions.cfg │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── actions_check_exit_code_ignored │ ├── actions.cfg │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── actions_check_output │ ├── actions.cfg │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── launch_failure_0.txt │ │ ├── lhs.txt │ │ └── test.toast ├── actions_check_output_failed │ ├── actions.cfg │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ └── test.toast ├── actions_config_file │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── lunchtoast.cfg │ │ └── test.toast ├── actions_config_file_parent_dir │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lunchtoast.cfg │ │ └── subtest │ │ ├── lhs.txt │ │ └── test.toast ├── actions_config_files_merge │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lunchtoast.cfg │ │ └── subtest │ │ ├── lhs.txt │ │ ├── lunchtoast.cfg │ │ └── test.toast ├── actions_dont_stop_on_failure │ ├── actions.cfg │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ └── test.toast ├── actions_multiple_params │ ├── actions.cfg │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── actions_sections │ ├── actions.cfg │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── assert_failed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── lhs2.txt │ │ ├── rhs.txt │ │ ├── rhs2.txt │ │ └── test.toast ├── assert_passed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── collect_failed │ ├── failed_tests_dir.ref │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── failed │ │ └── test.toast │ │ ├── failed2 │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast │ │ └── test.toast ├── commandline_error_empty │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── commandline_error_unexistent_file │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── commandline_ext │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── commandline_help │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── commandline_report_width │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── commandline_save_contents │ ├── lunchtoast.test │ ├── lunchtoast_test.ref │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── commandline_save_contents_update │ ├── lunchtoast.test │ ├── lunchtoast_test.ref │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── file_to_preserve.txt │ │ ├── lhs.txt │ │ └── rhs.txt ├── compare_data_files_failed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lf.txt │ │ └── test.toast ├── compare_data_files_failed_windows │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lf.txt │ │ └── test.toast ├── compare_outside_text_files_passed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── crlf.txt │ │ └── subtest │ │ ├── lf.txt │ │ └── test.toast ├── compare_text_files_passed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── crlf.txt │ │ ├── lf.txt │ │ └── test.toast ├── content_of_file_error_missing_file │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── content_of_file_failed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── file.txt │ │ └── test.toast ├── content_of_file_passed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── file.txt │ │ ├── file2.txt │ │ └── test.toast ├── expect_error_exit_code_passed │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── expect_error_output_failed │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── expect_error_output_passed │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── expect_exit_code_failed │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── expect_exit_code_passed │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── expect_failed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── lhs2.txt │ │ ├── rhs.txt │ │ ├── rhs2.txt │ │ └── test.toast ├── expect_output_failed │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── expect_output_passed │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── expect_passed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── launch_command_detached │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── launch_command_failed │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── launch_command_ignoring_output │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── launch_command_passed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── test.ref │ │ └── test.toast ├── launch_process_failed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── process.sh │ │ └── test.toast ├── launch_process_failed_windows │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── process.bat │ │ └── test.toast ├── launch_process_passed │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── process.sh │ │ ├── test.ref │ │ └── test.toast ├── launch_process_passed_windows │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── process.bat │ │ ├── test.ref │ │ └── test.toast ├── launch_unchecked_command │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── launch_unchecked_process │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── process.sh │ │ └── test.toast ├── launch_unchecked_process_windows │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── process.bat │ │ └── test.toast ├── launch_unexistent_process_error │ ├── report.ref │ ├── test.toast │ └── test │ │ └── test.toast ├── linux_vars.shoal ├── list_failed │ ├── failed_tests.ref │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── failed │ │ └── test.toast │ │ ├── failed2 │ │ └── test.toast │ │ └── test.toast ├── multiple_enabled │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ ├── test.toast │ │ ├── test2 │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast │ │ └── test3 │ │ ├── lhs.txt │ │ ├── rhs2.txt │ │ └── test.toast ├── multiple_suites │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ ├── test.toast │ │ ├── test2 │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast │ │ └── test3 │ │ ├── lhs.txt │ │ ├── rhs2.txt │ │ └── test.toast ├── set_cleanup │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── data │ │ └── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── set_contents │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── data │ │ └── lhs.txt │ │ ├── data2 │ │ ├── inner │ │ │ └── preserved.txt │ │ ├── lhs.txt │ │ └── rhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── set_contents_windows │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── data │ │ └── lhs.txt │ │ ├── data2 │ │ ├── inner │ │ │ └── preserved.txt │ │ ├── lhs.txt │ │ └── rhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── set_description │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── lhs2.txt │ │ ├── rhs.txt │ │ ├── rhs2.txt │ │ └── test.toast ├── set_description_with_vars │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── lhs2.txt │ │ ├── rhs.txt │ │ ├── rhs2.txt │ │ └── test.toast ├── set_enabled │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── set_multiline_description │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── lhs2.txt │ │ ├── rhs.txt │ │ ├── rhs2.txt │ │ └── test.toast ├── set_name │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── set_name_with_vars │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── set_shell_command │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── test.ref │ │ └── test.toast ├── set_shell_command_windows │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── test.ref │ │ └── test.toast ├── set_suite │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── set_suite_with_vars │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lhs.txt │ │ ├── rhs.txt │ │ └── test.toast ├── set_tag_variables │ ├── report.ref │ ├── test.toast │ ├── test │ │ ├── test_0 │ │ │ ├── 0.txt │ │ │ └── test.toast │ │ ├── test_1 │ │ │ ├── 1.txt │ │ │ └── test.toast │ │ └── test_2 │ │ │ ├── 2.txt │ │ │ └── test.toast │ └── vars.cfg ├── set_variables │ ├── report.ref │ ├── test.toast │ ├── test │ │ ├── lhs.txt │ │ ├── multiline.txt │ │ └── test.toast │ └── vars.cfg ├── set_variables_merge │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── lunchtoast.cfg │ │ └── subtest │ │ ├── lhs.txt │ │ ├── lunchtoast.cfg │ │ ├── multiline.txt │ │ └── test.toast ├── tag_select │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── test_first │ │ └── test.toast │ │ └── test_second │ │ └── test.toast ├── tag_select_multi │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── test_first │ │ └── test.toast │ │ ├── test_second │ │ └── test.toast │ │ └── test_third │ │ └── test.toast ├── tag_skip │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── test_first │ │ └── test.toast │ │ └── test_second │ │ └── test.toast ├── tag_skip_multi │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── test_first │ │ └── test.toast │ │ ├── test_second │ │ └── test.toast │ │ └── test_third │ │ └── test.toast ├── unicode │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── test.toast │ │ ├── рхс.txt │ │ └── 🥸.txt ├── windows_vars.shoal ├── write_file_failed_error │ ├── report.ref │ ├── test.toast │ └── test │ │ ├── dir │ │ └── tmp │ │ ├── test.ref │ │ └── test.toast ├── write_file_passed │ ├── report.ref │ ├── test.ref │ ├── test.toast │ ├── test │ │ └── test.toast │ └── test2.ref └── write_file_passed_custom_separator │ ├── report.ref │ ├── test.ref │ ├── test.toast │ ├── test │ └── test.toast │ └── test2.ref ├── src ├── commandline.h ├── comparefilecontent.cpp ├── comparefilecontent.h ├── comparefiles.cpp ├── comparefiles.h ├── config.h ├── constants.h ├── errors.h ├── filenamegroup.cpp ├── filenamegroup.h ├── launchprocess.cpp ├── launchprocess.h ├── launchprocessresult.h ├── linestream.cpp ├── linestream.h ├── main.cpp ├── processresultcheckmode.h ├── section.h ├── sectionsreader.cpp ├── sectionsreader.h ├── test.cpp ├── test.h ├── testaction.h ├── testactionresult.cpp ├── testactionresult.h ├── testactiontype.h ├── testcontentsgenerator.cpp ├── testcontentsgenerator.h ├── testlauncher.cpp ├── testlauncher.h ├── testreporter.cpp ├── testreporter.h ├── testresult.cpp ├── testresult.h ├── testsuite.h ├── useraction.cpp ├── useraction.h ├── useractionformatparser.cpp ├── useractionformatparser.h ├── utils.cpp ├── utils.h ├── wait.cpp ├── wait.h ├── writefile.cpp └── writefile.h ├── tests ├── CMakeLists.txt ├── assert_exception.h ├── test_sectionsreader.cpp ├── test_useractionformatparser.cpp └── test_utils.cpp └── vcpkg.json /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: WebKit 3 | AlignAfterOpenBracket: AlwaysBreak 4 | AllowAllArgumentsOnNextLine: false 5 | AllowAllConstructorInitializersOnNextLine: false 6 | AllowAllParametersOfDeclarationOnNextLine: false 7 | AllowShortFunctionsOnASingleLine: Empty 8 | AllowShortLambdasOnASingleLine: Empty 9 | AllowShortEnumsOnASingleLine: false 10 | AllowShortIfStatementsOnASingleLine: Never 11 | AllowShortLoopsOnASingleLine: false 12 | AllowShortBlocksOnASingleLine: Empty 13 | AlwaysBreakTemplateDeclarations: Yes 14 | BinPackArguments: false 15 | BinPackParameters: false 16 | BraceWrapping: 17 | AfterFunction: true 18 | BeforeElse: true 19 | BeforeLambdaBody: true 20 | BeforeWhile: true 21 | BeforeCatch: true 22 | BreakBeforeBraces: Custom 23 | BreakBeforeBinaryOperators: None 24 | BreakInheritanceList: AfterComma 25 | ColumnLimit: 120 26 | ContinuationIndentWidth: 8 27 | Cpp11BracedListStyle: true 28 | NamespaceIndentation: None 29 | PenaltyBreakBeforeFirstCallParameter: 0 30 | PenaltyReturnTypeOnItsOwnLine: 1000 31 | PenaltyBreakAssignment: 10 32 | SpaceBeforeCpp11BracedList: false 33 | SpaceInEmptyBlock: false 34 | SpaceInEmptyParentheses: false 35 | SpaceAfterTemplateKeyword: false 36 | SpacesInLineCommentPrefix: 37 | Minimum: 0 38 | Maximum: -1 39 | FixNamespaceComments: true 40 | UseCRLF: false 41 | IncludeCategories: 42 | # Headers in <> without extension. 43 | - Regex: '<[[:alnum:]\-_]+>' 44 | Priority: 6 45 | # Headers in <> from specific external libraries. 46 | - Regex: '<(gtest|gmock|boost|gsl)\/' 47 | Priority: 5 48 | # Headers in <> with subdirectory. 49 | - Regex: '<[[:alnum:]\-_]+\/' 50 | Priority: 4 51 | # Headers in <> with extension. 52 | - Regex: '<[[:alnum:].\-_]+>' 53 | Priority: 3 54 | # Headers in "" with subdirectory. 55 | - Regex: '"[[:alnum:]\-_]+\/' 56 | Priority: 2 57 | # Headers in "" with extension. 58 | - Regex: '"[[:alnum:].\-_]+"' 59 | Priority: 1 60 | ... 61 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | tags: [ "v*" ] 6 | 7 | jobs: 8 | build: 9 | name: ${{ matrix.config.name }} 10 | runs-on: ${{ matrix.config.os }} 11 | env: 12 | CC: ${{ matrix.config.cc }} 13 | CXX: ${{ matrix.config.cxx }} 14 | 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | config: 19 | - { 20 | name: "Ubuntu 20.04 clang", 21 | os: ubuntu-20.04, 22 | cmake_vars: "-DBoost_USE_STATIC_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON", 23 | cmake-preset: clang-release, 24 | artifacts: "build/lunchtoast" 25 | } 26 | - { 27 | name: "Windows Latest MSVC", 28 | os: windows-latest, 29 | cmake_vars: "-DVCPKG_TARGET_TRIPLET=x64-windows-static-md", 30 | cmake-preset: msvc-release, 31 | artifacts: "build/lunchtoast.exe" 32 | } 33 | steps: 34 | - name: Install ninja (Windows) 35 | if: matrix.config.os == 'windows-latest' 36 | run: choco install ninja 37 | - name: Install ninja (Linux) 38 | if: matrix.config.os == 'ubuntu-20.04' 39 | run: sudo apt install ninja-build 40 | - uses: actions/checkout@v4 41 | 42 | - uses: hendrikmuhs/ccache-action@v1.2 43 | - uses: ilammy/msvc-dev-cmd@v1 44 | 45 | - uses: lukka/run-vcpkg@v10 46 | with: 47 | vcpkgGitCommitId: 31a159c1cae2bf905299085d9ef01bdfea0ca7b8 48 | 49 | - name: Configure CMake 50 | run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=ON ${{ matrix.config.cmake_vars }} -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake --preset="${{ matrix.config.cmake-preset }}" 51 | 52 | - name: Build 53 | run: cmake --build ${{github.workspace}}/build --config Release 54 | 55 | - name: Upload build artifact 56 | uses: actions/upload-artifact@v3 57 | with: 58 | name: lunchtoast-build-${{ matrix.config.os }} 59 | path: ${{ matrix.config.artifacts }} 60 | 61 | release: 62 | name: Release 63 | needs: build 64 | runs-on: ubuntu-20.04 65 | steps: 66 | - name: Download lunchtoast build 67 | uses: actions/download-artifact@v3 68 | with: 69 | name: lunchtoast-build-ubuntu-20.04 70 | path: build 71 | - name: Download lunchtoast build 72 | uses: actions/download-artifact@v3 73 | with: 74 | name: lunchtoast-build-windows-latest 75 | path: build 76 | - name: Upload release 77 | uses: softprops/action-gh-release@v1 78 | with: 79 | files: | 80 | build/lunchtoast.exe 81 | build/lunchtoast -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | project(lunchtoast VERSION 0.4.1 DESCRIPTION "lunchtoast - a command-line tool for functional testing of console applications.") 3 | 4 | find_package(Boost 1.78 REQUIRED COMPONENTS system filesystem) 5 | include(external/seal_lake) 6 | 7 | SealLake_Import(sfun 5.1.0 8 | GIT_REPOSITORY https://github.com/kamchatka-volcano/sfun 9 | GIT_TAG v5.1.0 10 | ) 11 | 12 | SealLake_Import(cmdlime 2.6.0 13 | GIT_REPOSITORY https://github.com/kamchatka-volcano/cmdlime 14 | GIT_TAG v2.6.0 15 | ) 16 | set(FIGCONE_USE_SHOAL ON) 17 | SealLake_Import(figcone 3.1.0 18 | GIT_REPOSITORY https://github.com/kamchatka-volcano/figcone 19 | GIT_TAG v3.1.0 20 | ) 21 | SealLake_Import(fmt 9.1.0 22 | GIT_REPOSITORY https://github.com/fmtlib/fmt 23 | GIT_TAG 9.1.0 24 | ) 25 | set(SPDLOG_FMT_EXTERNAL ON) 26 | SealLake_Import(spdlog 1.11.0 27 | GIT_REPOSITORY https://github.com/gabime/spdlog 28 | GIT_TAG v1.11.0 29 | ) 30 | 31 | SealLake_Import(GSL 4.0.0 32 | GIT_REPOSITORY https://github.com/microsoft/GSL.git 33 | GIT_TAG v4.0.0 34 | ) 35 | 36 | SealLake_Import(platform_folders 4.2.0 37 | GIT_REPOSITORY https://github.com/sago007/PlatformFolders.git 38 | GIT_TAG 4.2.0 39 | ) 40 | 41 | SealLake_Bundle( 42 | NAME range-v3 43 | SKIP_LOAD 44 | GIT_REPOSITORY https://github.com/ericniebler/range-v3 45 | GIT_TAG 0.12.0 46 | ) 47 | 48 | set(SRC 49 | src/testcontentsgenerator.cpp 50 | src/comparefilecontent.cpp 51 | src/comparefiles.cpp 52 | src/filenamegroup.cpp 53 | src/launchprocess.cpp 54 | src/linestream.cpp 55 | src/main.cpp 56 | src/sectionsreader.cpp 57 | src/testactionresult.cpp 58 | src/test.cpp 59 | src/testlauncher.cpp 60 | src/testreporter.cpp 61 | src/testresult.cpp 62 | src/useraction.cpp 63 | src/useractionformatparser.cpp 64 | src/utils.cpp 65 | src/writefile.cpp 66 | src/wait.cpp 67 | ) 68 | 69 | SealLake_Executable( 70 | SOURCES ${SRC} 71 | COMPILE_FEATURES cxx_std_20 72 | PROPERTIES 73 | CXX_EXTENSIONS OFF 74 | INCLUDES ${SEAL_LAKE_SOURCE_range-v3}/include 75 | LIBRARIES 76 | Boost::boost 77 | Boost::filesystem 78 | spdlog::spdlog 79 | sfun::sfun 80 | cmdlime::cmdlime 81 | figcone::figcone 82 | fmt::fmt 83 | Microsoft.GSL::GSL 84 | sago::platform_folders 85 | ) 86 | target_compile_definitions(lunchtoast PRIVATE _UNICODE UNICODE) 87 | 88 | SealLake_OptionalSubProjects(tests) 89 | 90 | -------------------------------------------------------------------------------- /CMakePresets.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 6, 3 | "configurePresets": [ 4 | { 5 | "name": "base-linux", 6 | "hidden": true, 7 | "displayName": "linux base preset", 8 | "generator": "Ninja", 9 | "binaryDir": "build-${presetName}", 10 | "cacheVariables": { 11 | "CMAKE_CXX_COMPILER": "clang++", 12 | "CMAKE_C_COMPILER": "clang", 13 | "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", 14 | "CPM_SOURCE_CACHE": "cpm_cache" 15 | } 16 | }, 17 | { 18 | "name": "clang-base", 19 | "hidden": true, 20 | "displayName": "clang base preset", 21 | "inherits": "base-linux", 22 | "cacheVariables": { 23 | "CMAKE_CXX_COMPILER": "clang++", 24 | "CMAKE_C_COMPILER": "clang", 25 | "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Werror -Wcast-align -Wnon-virtual-dtor -Woverloaded-virtual -Wunused" 26 | } 27 | }, 28 | { 29 | "name": "clang-debug", 30 | "displayName": "clang (Debug)", 31 | "inherits": "clang-base", 32 | "cacheVariables": { 33 | "CMAKE_BUILD_TYPE": "Debug" 34 | } 35 | }, 36 | { 37 | "name": "clang-release", 38 | "displayName": "clang (Release)", 39 | "inherits": "clang-base", 40 | "cacheVariables": { 41 | "CMAKE_BUILD_TYPE": "Release" 42 | } 43 | }, 44 | { 45 | "name": "gcc-base", 46 | "hidden": true, 47 | "displayName": "gcc base preset", 48 | "inherits": "base-linux", 49 | "cacheVariables": { 50 | "CMAKE_CXX_COMPILER": "g++-10", 51 | "CMAKE_C_COMPILER": "gcc-10", 52 | "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Werror -Wcast-align -Wnon-virtual-dtor -Woverloaded-virtual -Wunused" 53 | } 54 | }, 55 | { 56 | "name": "gcc-debug", 57 | "displayName": "gcc (Debug)", 58 | "inherits": "gcc-base", 59 | "cacheVariables": { 60 | "CMAKE_BUILD_TYPE": "Debug" 61 | } 62 | }, 63 | { 64 | "name": "gcc-release", 65 | "displayName": "gcc (Release)", 66 | "inherits": "gcc-base", 67 | "cacheVariables": { 68 | "CMAKE_BUILD_TYPE": "Release" 69 | } 70 | }, 71 | { 72 | "name": "base-windows", 73 | "displayName": "windows base preset", 74 | "hidden": true, 75 | "generator": "Ninja", 76 | "binaryDir": "build-${presetName}", 77 | "architecture": { 78 | "value": "x64", 79 | "strategy": "external" 80 | }, 81 | "cacheVariables": { 82 | "CPM_SOURCE_CACHE": "cpm_cache", 83 | "CMAKE_CXX_COMPILER_LAUNCHER": "ccache" 84 | }, 85 | "vendor": { 86 | "microsoft.com/VisualStudioSettings/CMake/1.0": { 87 | "hostOS": [ 88 | "Windows" 89 | ] 90 | }, 91 | "jetbrains.com/clion": { 92 | "toolchain": "Visual Studio" 93 | } 94 | } 95 | }, 96 | { 97 | "name": "msvc-base", 98 | "hidden": true, 99 | "displayName": "msvc base preset", 100 | "inherits": "base-windows", 101 | "cacheVariables": { 102 | "CMAKE_CXX_COMPILER": "cl.exe", 103 | "CMAKE_C_COMPILER": "cl.exe", 104 | "CMAKE_CXX_FLAGS": "/EHsc /W4 /WX /wd4702" 105 | } 106 | }, 107 | { 108 | "name": "msvc-debug", 109 | "displayName": "msvc (Debug)", 110 | "inherits": "msvc-base", 111 | "cacheVariables": { 112 | "CMAKE_BUILD_TYPE": "Debug" 113 | } 114 | }, 115 | { 116 | "name": "msvc-release", 117 | "displayName": "msvc (Release)", 118 | "inherits": "msvc-base", 119 | "cacheVariables": { 120 | "CMAKE_BUILD_TYPE": "Release" 121 | } 122 | } 123 | ] 124 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Microsoft Public License (Ms-PL) 2 | Copyright 2021 Gorelyy PA 3 | 4 | This license governs use of the accompanying software. If you use the software, 5 | you accept this license. If you do not accept the license, do not use the 6 | software. 7 | 8 | 1. Definitions 9 | 10 | The terms "reproduce," "reproduction," "derivative works," and "distribution" 11 | have the same meaning here as under U.S. copyright law. 12 | 13 | A "contribution" is the original software, or any additions or changes to the 14 | software. 15 | 16 | A "contributor" is any person that distributes its contribution under this 17 | license. 18 | 19 | "Licensed patents" are a contributor's patent claims that read directly on its 20 | contribution. 21 | 22 | 2. Grant of Rights 23 | 24 | (A) Copyright Grant- Subject to the terms of this license, including the 25 | license conditions and limitations in section 3, each contributor grants you a 26 | non-exclusive, worldwide, royalty-free copyright license to reproduce its 27 | contribution, prepare derivative works of its contribution, and distribute its 28 | contribution or any derivative works that you create. 29 | 30 | (B) Patent Grant- Subject to the terms of this license, including the license 31 | conditions and limitations in section 3, each contributor grants you a 32 | non-exclusive, worldwide, royalty-free license under its licensed patents to 33 | make, have made, use, sell, offer for sale, import, and/or otherwise dispose of 34 | its contribution in the software or derivative works of the contribution in the 35 | software. 36 | 37 | 3. Conditions and Limitations 38 | 39 | (A) No Trademark License- This license does not grant you rights to use any 40 | contributors' name, logo, or trademarks. 41 | 42 | (B) If you bring a patent claim against any contributor over patents that you 43 | claim are infringed by the software, your patent license from such contributor 44 | to the software ends automatically. 45 | 46 | (C) If you distribute any portion of the software, you must retain all 47 | copyright, patent, trademark, and attribution notices that are present in the 48 | software. 49 | 50 | (D) If you distribute any portion of the software in source code form, you may 51 | do so only under this license by including a complete copy of this license with 52 | your distribution. If you distribute any portion of the software in compiled or 53 | object code form, you may only do so under a license that complies with this 54 | license. 55 | 56 | (E) The software is licensed "as-is." You bear the risk of using it. The 57 | contributors give no express warranties, guarantees or conditions. You may have 58 | additional consumer rights under your local laws which this license cannot 59 | change. To the extent permitted under your local laws, the contributors exclude 60 | the implied warranties of merchantability, fitness for a particular purpose and 61 | non-infringement. 62 | -------------------------------------------------------------------------------- /external/seal_lake: -------------------------------------------------------------------------------- 1 | include(FetchContent) 2 | set(SEAL_LAKE_VERSION v0.2.0) 3 | set(FETCHCONTENT_QUIET FALSE) 4 | FetchContent_Declare(seal_lake_${SEAL_LAKE_VERSION} 5 | SOURCE_DIR seal_lake_${SEAL_LAKE_VERSION} 6 | GIT_REPOSITORY "https://github.com/kamchatka-volcano/seal_lake.git" 7 | GIT_TAG ${SEAL_LAKE_VERSION} 8 | ) 9 | FetchContent_MakeAvailable(seal_lake_${SEAL_LAKE_VERSION}) 10 | include(${seal_lake_${SEAL_LAKE_VERSION}_SOURCE_DIR}/seal_lake.cmake) -------------------------------------------------------------------------------- /functional_tests/actions/actions.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Assert text of %1 4 | command = `[ "$(cat %1)" = "%input" ]` -------------------------------------------------------------------------------- /functional_tests/actions/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/actions/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref actions.cfg 3 | -Description: 4 | GIVEN action 'Assert text of' is declared in actions.cfg 5 | WHEN check lhs.txt content using this action 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=actions.cfg ${{ shellParam }} 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/actions/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/actions/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert text of lhs.txt: 2 | Hello world 3 | --- -------------------------------------------------------------------------------- /functional_tests/actions_check_error_output/actions.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Ensure error output "%1" 4 | command = echo %1 >&2 5 | checkErrorOutput = %input -------------------------------------------------------------------------------- /functional_tests/actions_check_error_output/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/actions_check_error_output/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: report.ref actions.cfg 3 | -Description: 4 | GIVEN action 'Ensure error output' is declared in actions.cfg 5 | WHEN comparing error output using this action 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=actions.cfg ${{ shellParam }} 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/actions_check_error_output/test/test.toast: -------------------------------------------------------------------------------- 1 | -Ensure error output "Hello world": 2 | Hello world 3 | 4 | --- -------------------------------------------------------------------------------- /functional_tests/actions_check_error_output_failed/actions.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Ensure error output "%1" 4 | command = echo %1 >&2 5 | checkErrorOutput = %input -------------------------------------------------------------------------------- /functional_tests/actions_check_error_output_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Launched process 'echo Hello world >&2' returned unexpected error output. More info in launch_0.failure_info 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/actions_check_error_output_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.ref} actions.cfg 3 | -Description: 4 | GIVEN action 'Ensure error output' is declared in actions.cfg 5 | WHEN comparing unexpected error output using this action 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=actions.cfg ${{ shellParam }} 9 | -Assert exit code: 1 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/actions_check_error_output_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Ensure error output "Hello world": 2 | Hello moon 3 | --- -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code/actions.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Ensure command works 4 | command = %input 5 | checkExitCode = 0 -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: report.ref actions.cfg 3 | -Description: 4 | GIVEN action 'Ensure command works' is declared in actions.cfg 5 | WHEN invoking correct ls command using this action 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=actions.cfg ${{ shellParam }} 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code/test/test.toast: -------------------------------------------------------------------------------- 1 | -Ensure command works: ls . -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code_failed/actions.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Ensure command works 4 | command = %input 5 | checkExitCode = 0 -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Launched process 'ls --dummy' returned unexpected exit code 2. More info in launch_0.failure_info 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test.toast report.ref actions.cfg 3 | -Description: 4 | GIVEN action 'Ensure command works' is declared in actions.cfg 5 | WHEN invoking incorrect ls command using this action 6 | THEN test should fail 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=actions.cfg ${{ shellParam }} 9 | -Assert exit code: 1 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Ensure command works: ls --dummy -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code_ignored/actions.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Run command unchecked 4 | command = %input 5 | checkExitCode = any -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code_ignored/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code_ignored/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test.toast report.ref actions.cfg 3 | -Description: 4 | GIVEN action 'Ensure command works' is declared in actions.cfg, which doesn't check an exit code 5 | WHEN invoking incorrect ls command using this action 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=actions.cfg ${{ shellParam }} 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/actions_check_exit_code_ignored/test/test.toast: -------------------------------------------------------------------------------- 1 | -Run command unchecked: ls --dummy -------------------------------------------------------------------------------- /functional_tests/actions_check_output/actions.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Assert text of %1 4 | command = cat %1 5 | checkOutput = %input -------------------------------------------------------------------------------- /functional_tests/actions_check_output/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/actions_check_output/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref actions.cfg 3 | -Description: 4 | GIVEN action 'Assert text of' is declared in actions.cfg 5 | WHEN check lhs.txt content using this action 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=actions.cfg ${{ shellParam }} 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/actions_check_output/test/launch_failure_0.txt: -------------------------------------------------------------------------------- 1 | -Command: /usr/bin/bash -ceo pipefail cat lhs.txt 2 | -Exit code: 1 3 | -Expected exit code: 0 4 | -Output: 5 | --- 6 | -Expected output: 7 | Hello world 8 | --- 9 | -Error output: 10 | cat: lhs.txt: No such file or directory 11 | --- 12 | -------------------------------------------------------------------------------- /functional_tests/actions_check_output/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/actions_check_output/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert text of lhs.txt: 2 | Hello world 3 | --- -------------------------------------------------------------------------------- /functional_tests/actions_check_output_failed/actions.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Assert text of %1 4 | command = cat %1 5 | checkOutput = %input -------------------------------------------------------------------------------- /functional_tests/actions_check_output_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Launched process 'cat lhs.txt' returned unexpected output. More info in launch_0.failure_info 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/actions_check_output_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test/lhs.txt report.ref actions.cfg 3 | -Description: 4 | GIVEN action 'Assert text of' is declared in actions.cfg 5 | WHEN compare lhs.txt content to a different string using this action 6 | THEN test should fail 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=actions.cfg ${{ shellParam }} 9 | -Assert exit code: 1 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/actions_check_output_failed/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello moon -------------------------------------------------------------------------------- /functional_tests/actions_check_output_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert text of lhs.txt: 2 | Hello world 3 | --- -------------------------------------------------------------------------------- /functional_tests/actions_config_file/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/actions_config_file/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref 3 | -Description: 4 | GIVEN action 'Assert text of' is declared in lunchtoast.cfg 5 | WHEN check lhs.txt content using this action, don't specify config file in command line 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{ shellParam }} 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/actions_config_file/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/actions_config_file/test/lunchtoast.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Assert text of %1 4 | command = `[ "$(cat %1)" = "%input" ]` -------------------------------------------------------------------------------- /functional_tests/actions_config_file/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert text of lhs.txt: 2 | Hello world 3 | --- -------------------------------------------------------------------------------- /functional_tests/actions_config_file_parent_dir/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: subtest 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/actions_config_file_parent_dir/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref 3 | -Description: 4 | GIVEN action 'Assert text of' is declared in lunchtoast.cfg placed outside of the parent directory 5 | WHEN check lhs.txt content using this action, don't specify config file in command line 6 | THEN test should pass 7 | --- 8 | -Launch: ../../build/lunchtoast ./test -reportFile=report.res --withoutCleanup ${{ shellParam }} 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/actions_config_file_parent_dir/test/lunchtoast.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Assert text of %1 4 | command = `[ "$(cat %1)" = "%input" ]` -------------------------------------------------------------------------------- /functional_tests/actions_config_file_parent_dir/test/subtest/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/actions_config_file_parent_dir/test/subtest/test.toast: -------------------------------------------------------------------------------- 1 | -Assert text of lhs.txt: 2 | Hello world 3 | --- -------------------------------------------------------------------------------- /functional_tests/actions_config_files_merge/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: subtest 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/actions_config_files_merge/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref 3 | -Description: 4 | GIVEN action 'Assert text of' is declared in test/lunchtoast.cfg and test/subdir/lunchtoast.cfg, 5 | action 'Check text of' is declared in test/lunchtoast.cfg 6 | WHEN check lhs.txt content using both this action, don't specify config file in command line 7 | THEN test should pass, 'Assert text of' should use the version declared in test/subdir/lunchtoast.cfg 8 | --- 9 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{ shellParam }} 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/actions_config_files_merge/test/lunchtoast.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Assert text of %1 4 | command = `[ "$(cat %1)" = "%input" ]` 5 | ### 6 | format = Check text of %1 7 | command = `[ "$(cat %1)" = "%input" ]` -------------------------------------------------------------------------------- /functional_tests/actions_config_files_merge/test/subtest/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/actions_config_files_merge/test/subtest/lunchtoast.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Assert text of %1 4 | command = `[ "$(cat %1)2" = "%input" ]` -------------------------------------------------------------------------------- /functional_tests/actions_config_files_merge/test/subtest/test.toast: -------------------------------------------------------------------------------- 1 | -Assert text of lhs.txt: 2 | Hello world2 3 | --- 4 | 5 | -Check text of lhs.txt: 6 | Hello world 7 | --- -------------------------------------------------------------------------------- /functional_tests/actions_dont_stop_on_failure/actions.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Expect text of %1 4 | command = `[ "$(cat %1)" = "%input" ]` 5 | stopOnFailure = false 6 | ### 7 | format = Assert text of %1 8 | command = cat %1 9 | checkOutput = %input -------------------------------------------------------------------------------- /functional_tests/actions_dont_stop_on_failure/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Launched process '[ "$(cat lhs.txt)" = "Hello moon" ]' returned unexpected exit code 1. More info in launch_0.failure_info 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/actions_dont_stop_on_failure/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test/lhs.txt test/test.toast test.toast report.ref actions.cfg 3 | -Description: 4 | GIVEN actions 'Expect text of' and 'Assert text of' are declared in actions.cfg 5 | WHEN check lhs.txt content using expect action (that doesn't stop on error), write a test file and check lhs.txt content using assert action 6 | THEN test should fail, test file should be created 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=actions.cfg ${{ shellParam }} 9 | -Assert exit code: 1 10 | -Assert ./test/test.txt: 11 | TEST 12 | --- 13 | -Assert files equal: report.res report.ref 14 | -------------------------------------------------------------------------------- /functional_tests/actions_dont_stop_on_failure/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/actions_dont_stop_on_failure/test/test.toast: -------------------------------------------------------------------------------- 1 | -Expect text of lhs.txt: 2 | Hello moon 3 | --- 4 | 5 | -Write test.txt: 6 | TEST 7 | --- 8 | 9 | -Assert text of lhs.txt: 10 | Hello world 11 | --- -------------------------------------------------------------------------------- /functional_tests/actions_multiple_params/actions.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Compare %1 and %2 4 | command = `[ "$(cat %1)" = "$(cat %2)" ]` -------------------------------------------------------------------------------- /functional_tests/actions_multiple_params/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/actions_multiple_params/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref actions.cfg 3 | -Description: 4 | GIVEN action 'Compare %1 and %2' is declared in actions.cfg 5 | WHEN comparing lhs.txt and rhs.txt using this action 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=actions.cfg ${{ shellParam }} 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/actions_multiple_params/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/actions_multiple_params/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/actions_multiple_params/test/test.toast: -------------------------------------------------------------------------------- 1 | -Contents: {.*\.txt} 2 | -Compare lhs.txt and rhs.txt 3 | -------------------------------------------------------------------------------- /functional_tests/actions_sections/actions.cfg: -------------------------------------------------------------------------------- 1 | #actions: 2 | ### 3 | format = Compare files 4 | command = `[ "$(cat %input.lhs)" = "$(cat %input.rhs)" ]` -------------------------------------------------------------------------------- /functional_tests/actions_sections/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/actions_sections/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref actions.cfg 3 | -Description: 4 | GIVEN action 'Compare files' is declared in actions.cfg 5 | WHEN comparing lhs.txt and rhs.txt using this action 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=actions.cfg ${{ shellParam }} 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/actions_sections/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/actions_sections/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/actions_sections/test/test.toast: -------------------------------------------------------------------------------- 1 | -Contents: {.*\.txt} 2 | 3 | -Compare files: 4 | #lhs: 5 | lhs.txt 6 | #rhs: 7 | rhs.txt 8 | --- -------------------------------------------------------------------------------- /functional_tests/assert_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Files lhs.txt and rhs.txt aren't equal 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/assert_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/lhs2.txt test/lhs.txt test/rhs2.txt test/test.toast test/rhs.txt test.toast report.ref 3 | -Description: 4 | GIVEN 2 different files (lhs.txt and rhs.txt) and 2 different files (lhs2.txt and rhs2.txt) 5 | WHEN test assertion of lhs.txt and rhs.txt equality, test assertion of lhs2.txt and rhs2.txt equality 6 | THEN first assertion should fail, test should fail after the first assertion without checking the second one 7 | --- 8 | -Launch unchecked: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 9 | -Assert exit code: 1 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/assert_failed/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/assert_failed/test/lhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/assert_failed/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/assert_failed/test/rhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/assert_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert files equal: lhs.txt rhs.txt 2 | -Assert files equal: lhs2.txt rhs2.txt 3 | -------------------------------------------------------------------------------- /functional_tests/assert_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/assert_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/lhs.txt test/test.toast test/rhs.txt test.toast report.ref 3 | -Description: 4 | GIVEN 2 equal files (lhs.txt and rhs.txt) 5 | WHEN test single assertion of files equality 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/assert_passed/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/assert_passed/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/assert_passed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert files equal: lhs.txt rhs.txt 2 | -------------------------------------------------------------------------------- /functional_tests/collect_failed/failed_tests_dir.ref: -------------------------------------------------------------------------------- 1 | failed_tests 2 | failed_tests/failed 3 | failed_tests/failed2 4 | failed_tests/failed2/lhs.txt 5 | failed_tests/failed2/rhs.txt 6 | failed_tests/failed2/test.toast 7 | failed_tests/failed/launch_0.failure_info 8 | failed_tests/failed/test.toast 9 | -------------------------------------------------------------------------------- /functional_tests/collect_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 3 ] ################### 2 | Name: test 3 | Result: PASSED 4 | ################## [ 2 / 3 ] ################### 5 | Name: failed 6 | Failure: Launched process 'unknown_process' returned unexpected exit code 127. More info in launch_0.failure_info 7 | Result: FAILED 8 | ################## [ 3 / 3 ] ################### 9 | Name: failed2 10 | Failure: Files lhs.txt and rhs.txt aren't equal 11 | Result: FAILED 12 | 13 | ################## SUMMARY ################### 14 | Default: 1 out of 3 passed, 2 failed 15 | --- 16 | Total: 1 out of 3 passed, 2 failed 17 | -------------------------------------------------------------------------------- /functional_tests/collect_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {test/failed2/.*\.txt} {.*\.ref} 3 | -Description: 4 | GIVEN 3 tests, 2 of them are failing 5 | WHEN launched with collectFailedTests parameter 6 | THEN directories with failed tests should be copied to the specified path 7 | --- 8 | -Launch: rm -rf failed_tests/ 9 | -Assert exit code: * 10 | 11 | -Launch: ../../build/lunchtoast ./test -reportFile=report.res --withoutCleanup -collectFailedTests=failed_tests ${{shellParam}} 12 | -Assert exit code: 1 13 | -Launch: find failed_tests | sort -d > failed_tests_dir.res 14 | -Assert files equal: report.res report.ref 15 | -Assert files equal: failed_tests_dir.res failed_tests_dir.ref 16 | 17 | -Launch: rm -rf failed_tests/ 18 | -Assert exit code: * -------------------------------------------------------------------------------- /functional_tests/collect_failed/test/failed/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: unknown_process 2 | -------------------------------------------------------------------------------- /functional_tests/collect_failed/test/failed2/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello moon -------------------------------------------------------------------------------- /functional_tests/collect_failed/test/failed2/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/collect_failed/test/failed2/test.toast: -------------------------------------------------------------------------------- 1 | -Assert files equal: lhs.txt rhs.txt 2 | -------------------------------------------------------------------------------- /functional_tests/collect_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_error_empty/report.ref: -------------------------------------------------------------------------------- 1 | Positional argument 'testPath' is missing. 2 | Usage: lunchtoast [commands] [-config=] [-shell=] [-listFailedTests=] [-collectFailedTests=] [-reportWidth=] [-reportFile=] [-searchDepth=] [-select=...] [-skip=...] [--withoutCleanup] [--help] [--version] 3 | 4 | -------------------------------------------------------------------------------- /functional_tests/commandline_error_empty/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: errors 3 | -Contents: test test/lhs.txt test/test.toast test/rhs.txt test.toast report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt) 6 | WHEN launch lunchtoast without command line parameters 7 | THEN lunchtoast should print usage info and exit 8 | --- 9 | -Launch: ../../build/lunchtoast > report.res 10 | -Assert exit code: * 11 | -Assert files equal: report.res report.ref 12 | -------------------------------------------------------------------------------- /functional_tests/commandline_error_empty/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_error_empty/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_error_empty/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert files equal: lhs.txt rhs.txt 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_error_unexistent_file/report.ref: -------------------------------------------------------------------------------- 1 | Argument 'testPath' is invalid: specified test directory 'test.cfg' doesn't exist. 2 | 3 | Usage: lunchtoast [commands] [-config=] [-shell=] [-listFailedTests=] [-collectFailedTests=] [-reportWidth=] [-reportFile=] [-searchDepth=] [-select=...] [-skip=...] [--withoutCleanup] [--help] [--version] 4 | 5 | -------------------------------------------------------------------------------- /functional_tests/commandline_error_unexistent_file/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: errors 3 | -Contents: test test/lhs.txt test/test.toast test/rhs.txt test.toast report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt) 6 | WHEN launch lunchtoast with passing path to unexistent test config 7 | THEN lunchtoast should print error message with usage info and exit 8 | --- 9 | -Launch: ../../build/lunchtoast test.cfg > report.res 10 | -Assert exit code: 1 11 | -Assert files equal: report.res report.ref 12 | -------------------------------------------------------------------------------- /functional_tests/commandline_error_unexistent_file/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_error_unexistent_file/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_error_unexistent_file/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert files equal: lhs.txt rhs.txt 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_ext/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/commandline_ext/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: command line 3 | -Contents: test test/lhs.txt test/test.toast test/rhs.txt test.toast report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt) 6 | WHEN test single assertion of files equality, launch test by specifying directory and extension of config file 7 | THEN test should pass 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/commandline_ext/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_ext/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_ext/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert files equal: lhs.txt rhs.txt 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_help/report.ref: -------------------------------------------------------------------------------- 1 | Usage: lunchtoast [commands] [params] [flags] 2 | Arguments: 3 | (path) directory containing tests 4 | Parameters: 5 | -config= config file for setting variables and 6 | actions 7 | (optional, default: "") 8 | -shell= shell command 9 | (optional, default: bash -ceo pipefail) 10 | -listFailedTests= write a list of failed tests to the 11 | specified file 12 | (optional, default: "") 13 | -collectFailedTests= copy directories containing failed tests to 14 | the specified path 15 | (optional, default: "") 16 | -reportWidth= set the test report's width as the number of 17 | characters 18 | (optional, default: 48) 19 | -reportFile= write the test report to the specified file 20 | (optional, default: "") 21 | -searchDepth= the number of descents into child 22 | directories levels for tests searching 23 | (optional) 24 | -select= select tests by tag names 25 | (multi-value, optional, default: {}) 26 | -skip= skip tests by tag names 27 | (multi-value, optional, default: {}) 28 | Flags: 29 | --withoutCleanup disable cleanup of test files 30 | --help show usage info and exit 31 | --version show version info and exit 32 | Commands: 33 | saveContents [options] save the current contents of the test 34 | directory 35 | 36 | -------------------------------------------------------------------------------- /functional_tests/commandline_help/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: command line 3 | -Contents: test test/test.toast test.toast report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt) 6 | WHEN launch lunchtoast with --help command line argument 7 | THEN lunchtoast should print usage info and exit 8 | --- 9 | -Launch unchecked: ../../build/lunchtoast --help > report.res 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/commandline_help/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert files equal: lhs.txt rhs.txt 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_report_width/report.ref: -------------------------------------------------------------------------------- 1 | ################################## [ 1 / 1 ] ################################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################################## SUMMARY ################################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/commandline_report_width/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/lhs.txt test/test.toast test/rhs.txt test.toast report.ref 3 | -Description: 4 | GIVEN 2 equal files (lhs.txt and rhs.txt) 5 | WHEN test single assertion of files equality, setting report width to 80 6 | THEN test should pass, report should have a width of 80 characters 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -reportWidth=80 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/commandline_report_width/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_report_width/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_report_width/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert files equal: lhs.txt rhs.txt 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents/lunchtoast.test: -------------------------------------------------------------------------------- 1 | #Some comment 2 | -Assert files equal: lhs.txt rhs.txt 3 | #Other comment 4 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents/lunchtoast_test.ref: -------------------------------------------------------------------------------- 1 | #Some comment 2 | -Assert files equal: lhs.txt rhs.txt 3 | #Other comment 4 | -Contents: lhs.txt rhs.txt test.toast 5 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents/report.ref: -------------------------------------------------------------------------------- 1 | Generating test contents in test config 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: command line 3 | -Contents: test test/lhs.txt test/rhs.txt lunchtoast_test.ref lunchtoast.test test.toast report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt) 6 | WHEN launch lunchtoast with saveContents command 7 | THEN test config should get a contents section with list of test files 8 | --- 9 | -Launch: cp lunchtoast.test test/test.toast 10 | -Launch: ../../build/lunchtoast saveContents test/ | sed 's/~\|\/[^ ]*//g' > report.res 11 | -Assert files equal: report.res report.ref 12 | -Assert files equal: test/test.toast lunchtoast_test.ref 13 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents/test/test.toast: -------------------------------------------------------------------------------- 1 | #Some comment 2 | -Assert files equal: lhs.txt rhs.txt 3 | #Other comment 4 | -Contents: lhs.txt rhs.txt test.toast 5 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents_update/lunchtoast.test: -------------------------------------------------------------------------------- 1 | #Some comment 2 | -Contents: lhs.txt lunchtoast.test rhs.txt 3 | -Assert files equal: lhs.txt rhs.txt 4 | #Other comment 5 | 6 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents_update/lunchtoast_test.ref: -------------------------------------------------------------------------------- 1 | #Some comment 2 | -Contents: file_to_preserve.txt lhs.txt rhs.txt test.toast 3 | -Assert files equal: lhs.txt rhs.txt 4 | #Other comment 5 | 6 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents_update/report.ref: -------------------------------------------------------------------------------- 1 | Generating test contents in test config 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents_update/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: command line 3 | -Contents: test test/file_to_preserve.txt test/lhs.txt test/rhs.txt lunchtoast_test.ref lunchtoast.test test.toast report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt) and empty file file_to_preserve.txt, 6 | test config has a cleanup whitelist, listing all test files except file_to_preserve.txt 7 | WHEN launch lunchtoast with --saveContents 8 | THEN test config should get file_to_preserve.txt in a contents section 9 | --- 10 | -Launch: cp lunchtoast.test test/test.toast 11 | -Launch: ../../build/lunchtoast saveContents test/ | sed 's/~\|\/[^ ]*//g' > report.res 12 | -Assert files equal: report.res report.ref 13 | -Assert files equal: test/test.toast lunchtoast_test.ref 14 | 15 | -Launch: rm -rf test/test.toast 16 | -Assert exit code: * -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents_update/test/file_to_preserve.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamchatka-volcano/lunchtoast/6202af9744d759556d238ba54f957229c452b39c/functional_tests/commandline_save_contents_update/test/file_to_preserve.txt -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents_update/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/commandline_save_contents_update/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/compare_data_files_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Files crlf.txt and lf.txt aren't equal 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/compare_data_files_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test/lf.txt test/test.toast report.ref 3 | -Tags: linux 4 | -Description: 5 | GIVEN 2 text files (crlf.txt and lf.txt) with equal text by different line separators (\r\n and \n) 6 | WHEN test assertion of files equality as binary data 7 | THEN the test should fail 8 | --- 9 | -Launch: echo -en "Hello world\r\n" > test/crlf.txt 10 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 11 | -Expect exit code: 1 12 | -Assert files equal: report.res report.ref 13 | -------------------------------------------------------------------------------- /functional_tests/compare_data_files_failed/test/lf.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/compare_data_files_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert data files equal: crlf.txt lf.txt 2 | 3 | -------------------------------------------------------------------------------- /functional_tests/compare_data_files_failed_windows/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Files crlf.txt and lf.txt aren't equal 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/compare_data_files_failed_windows/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test/lf.txt test/test.toast report.ref 3 | -Tags: windows 4 | -Description: 5 | GIVEN 2 text files (crlf.txt and lf.txt) with equal text by different line separators (\r\n and \n) 6 | WHEN test assertion of files equality as binary data 7 | THEN the test should fail 8 | --- 9 | -Launch: echo -en "Hello world\n" > test/crlf.txt 10 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 11 | -Expect exit code: 1 12 | -Assert files equal: report.res report.ref 13 | -------------------------------------------------------------------------------- /functional_tests/compare_data_files_failed_windows/test/lf.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/compare_data_files_failed_windows/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert data files equal: crlf.txt lf.txt 2 | 3 | -------------------------------------------------------------------------------- /functional_tests/compare_outside_text_files_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: subtest 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/compare_outside_text_files_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref 3 | -Description: 4 | GIVEN 2 text files (../crlf.txt and lf.txt) with equal text by different line separators (\r\n and \n) 5 | WHEN test assertion of files equality by the text 6 | THEN the test should pass 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/compare_outside_text_files_passed/test/crlf.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/compare_outside_text_files_passed/test/subtest/lf.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/compare_outside_text_files_passed/test/subtest/test.toast: -------------------------------------------------------------------------------- 1 | -Assert files equal: ../crlf.txt lf.txt 2 | 3 | -------------------------------------------------------------------------------- /functional_tests/compare_text_files_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/compare_text_files_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test/crlf.txt test/lf.txt test/test.toast report.ref 3 | -Description: 4 | GIVEN 2 text files (crlf.txt and lf.txt) with equal text by different line separators (\r\n and \n) 5 | WHEN test assertion of files equality by the text 6 | THEN the test should pass 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/compare_text_files_passed/test/crlf.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/compare_text_files_passed/test/lf.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/compare_text_files_passed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert files equal: crlf.txt lf.txt 2 | 3 | -------------------------------------------------------------------------------- /functional_tests/content_of_file_error_missing_file/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: File content check has failed: file.txt doesn't exist 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/content_of_file_error_missing_file/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: errors 3 | -Contents: test test/test.toast test.toast report.ref 4 | -Description: 5 | GIVEN tested file is missing (file.txt) 6 | WHEN test assertion of unexistent file content with matching string 7 | THEN assertion and test should fail because of an error 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert exit code: 1 11 | -Assert files equal: report.res report.ref 12 | -------------------------------------------------------------------------------- /functional_tests/content_of_file_error_missing_file/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert file.txt: 2 | Hello world 3 | --- -------------------------------------------------------------------------------- /functional_tests/content_of_file_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: File file.txt content isn't equal to the expected string 'Hello world2' 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/content_of_file_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test/file.txt test.toast report.ref 3 | -Description: 4 | GIVEN a single file (file.txt) 5 | WHEN test assertion of file content with non matching string 6 | THEN first assertion should fail, test should fail 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 9 | -Assert exit code: 1 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/content_of_file_failed/test/file.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/content_of_file_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert file.txt: 2 | Hello world2 3 | --- -------------------------------------------------------------------------------- /functional_tests/content_of_file_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/content_of_file_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test/file.txt test/file2.txt test.toast report.ref 3 | -Description: 4 | GIVEN a single file (file.txt) 5 | WHEN test assertion of file content with matching string 6 | THEN first assertion should pass, test should pass 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/content_of_file_passed/test/file.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | - Yes 3 | # No -------------------------------------------------------------------------------- /functional_tests/content_of_file_passed/test/file2.txt: -------------------------------------------------------------------------------- 1 | Hello world2 -------------------------------------------------------------------------------- /functional_tests/content_of_file_passed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Expect file.txt: 2 | Hello world 3 | - Yes 4 | # No 5 | --- 6 | #Content of file from the same line 7 | -Assert file2.txt:Hello world2 -------------------------------------------------------------------------------- /functional_tests/expect_error_exit_code_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/expect_error_exit_code_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test.toast report.ref 3 | -Description: 4 | GIVEN expecting and error exit code of the launched command 5 | WHEN launching a shell command with invalid arguments 6 | THEN the test should pass 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 9 | -Expect files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/expect_error_exit_code_passed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: ls --dummy 2 | -Expect exit code: 2 -------------------------------------------------------------------------------- /functional_tests/expect_error_output_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Launched process 'echo "Hello world" >&2' returned unexpected error output. More info in launch_0.failure_info 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/expect_error_output_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test.toast report.ref 3 | -Description: 4 | GIVEN expecting an error output "Hello moon" of the launched command 5 | WHEN launching a shell command outputting "Hello world" to stderr 6 | THEN the test should fail 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 9 | -Assert exit code: 1 10 | -Expect files equal: report.res report.ref 11 | 12 | -------------------------------------------------------------------------------- /functional_tests/expect_error_output_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" >&2 2 | -Expect error output: 3 | Hello moon 4 | --- 5 | -------------------------------------------------------------------------------- /functional_tests/expect_error_output_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/expect_error_output_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test.toast report.ref 3 | -Description: 4 | GIVEN expecting an error output "Hello world" of the launched command 5 | WHEN launching a shell command outputting "Hello world" to stderr 6 | THEN the test should pass 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 9 | -Expect files equal: report.res report.ref -------------------------------------------------------------------------------- /functional_tests/expect_error_output_passed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" >&2 2 | -Expect error output: 3 | Hello world 4 | 5 | --- 6 | -------------------------------------------------------------------------------- /functional_tests/expect_exit_code_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Launched process 'ls --dummy' returned unexpected exit code 2. More info in launch_0.failure_info 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/expect_exit_code_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test.toast report.ref 3 | -Description: 4 | GIVEN expecting a success exit code (0) of the launched command 5 | WHEN launching a shell command with invalid arguments 6 | THEN the test should fail 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 9 | -Assert exit code: 1 10 | -Expect files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/expect_exit_code_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: ls --dummy 2 | -Expect exit code: 0 -------------------------------------------------------------------------------- /functional_tests/expect_exit_code_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/expect_exit_code_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test.toast report.ref 3 | -Description: 4 | GIVEN expecting a success exit code (0) of the launched command 5 | WHEN launching a shell command outputting "Hello world" to stdout 6 | THEN the test should pass 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 9 | -Expect files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/expect_exit_code_passed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" 2 | -Expect exit code: 0 3 | -Expect output: 4 | Hello world 5 | 6 | --- -------------------------------------------------------------------------------- /functional_tests/expect_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: 4 | Files lhs.txt and rhs.txt aren't equal 5 | Files lhs2.txt and rhs2.txt aren't equal 6 | Result: FAILED 7 | 8 | ################## SUMMARY ################### 9 | Default: 0 out of 1 passed, 1 failed 10 | --- 11 | Total: 0 out of 1 passed, 1 failed 12 | -------------------------------------------------------------------------------- /functional_tests/expect_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/lhs2.txt test/lhs.txt test/rhs2.txt test/test.toast test/rhs.txt test.toast report.ref 3 | -Description: 4 | GIVEN 2 different files (lhs.txt and rhs.txt) and 2 different files (lhs2.txt rhs2.txt) 5 | WHEN test two expectations of files equality 6 | THEN first expectation should fail, second expectation should fail, after that the test should fail 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 9 | -Assert exit code: 1 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/expect_failed/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/expect_failed/test/lhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/expect_failed/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/expect_failed/test/rhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/expect_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Expect files equal: lhs.txt rhs.txt 2 | -Expect files equal: lhs2.txt rhs2.txt 3 | -------------------------------------------------------------------------------- /functional_tests/expect_output_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Launched process 'echo "Hello world"' returned unexpected output. More info in launch_0.failure_info 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/expect_output_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test.toast report.ref 3 | -Description: 4 | GIVEN expecting the launched command to output "Hello world" 5 | WHEN launching a shell command outputting "Hello moon" 6 | THEN the test should fail 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 9 | -Assert exit code: 1 10 | -Expect files equal: report.res report.ref -------------------------------------------------------------------------------- /functional_tests/expect_output_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" 2 | -Expect output: 3 | Hello moon 4 | --- 5 | -------------------------------------------------------------------------------- /functional_tests/expect_output_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/expect_output_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test.toast report.ref 3 | -Description: 4 | GIVEN expecting the launched command to output "Hello world" 5 | WHEN launching a shell command outputting "Hello world" 6 | THEN the test should pass 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 9 | -Expect files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/expect_output_passed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" 2 | -Expect output: 3 | Hello world 4 | 5 | --- 6 | -------------------------------------------------------------------------------- /functional_tests/expect_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/expect_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/lhs.txt test/test.toast test/rhs.txt test.toast report.ref 3 | -Description: 4 | GIVEN 2 equal files (lhs.txt and rhs.txt) 5 | WHEN test a single expectation of files equality 6 | THEN test should pass 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 9 | -Expect files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/expect_passed/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/expect_passed/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/expect_passed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Expect files equal: lhs.txt rhs.txt 2 | -------------------------------------------------------------------------------- /functional_tests/launch_command_detached/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/launch_command_detached/test.toast: -------------------------------------------------------------------------------- 1 | -Tags: linux 2 | -Contents: report.ref 3 | -Description: 4 | GIVEN file test.ref 5 | WHEN launching a detached shell command that adds a new line to file test.res every second, sleep for 2 seconds, and check that file test.res has more than 1 line. 6 | THEN test should pass 7 | --- 8 | 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/launch_command_detached/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch detached: while true; do echo "Hello world" >> test.res; sleep 1; done 2 | -Launch: sleep 2; 3 | -Launch: [ $(wc -l < test.res) != 1 ] 4 | -------------------------------------------------------------------------------- /functional_tests/launch_command_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Launched process 'cat test.res' returned unexpected exit code 1. More info in launch_0.failure_info 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/launch_command_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test.toast report.ref 3 | -Description: 4 | GIVEN file test.ref 5 | WHEN launching shell command that outputs content of unexistent file test.res 6 | THEN test should fail 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 9 | -Assert exit code: 1 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/launch_command_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: cat test.res 2 | -------------------------------------------------------------------------------- /functional_tests/launch_command_ignoring_output/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/launch_command_ignoring_output/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.ref test/test.toast test.toast report.ref 3 | -Description: 4 | GIVEN file test.ref 5 | WHEN launching shell command that outputs string "Hello world" and ignoring output, check that output is empty 6 | THEN test should pass 7 | --- 8 | -Launch: rm test/test.res 9 | -Assert exit code: * 10 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 11 | -Assert files equal: report.res report.ref 12 | -------------------------------------------------------------------------------- /functional_tests/launch_command_ignoring_output/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch ignoring output: echo "Hello world" 2 | -Assert output: 3 | --- 4 | 5 | -Launch and ignore output: echo "Hello moon" 6 | -Assert output: 7 | --- 8 | -------------------------------------------------------------------------------- /functional_tests/launch_command_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/launch_command_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.ref test/test.toast test.toast report.ref 3 | -Description: 4 | GIVEN file test.ref 5 | WHEN launching shell command that outputs content of test.ref to file test.res and assert that files are equal 6 | THEN test should pass 7 | --- 8 | -Launch: rm test/test.res 9 | -Assert exit code: * 10 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 11 | -Assert files equal: report.res report.ref 12 | -------------------------------------------------------------------------------- /functional_tests/launch_command_passed/test/test.ref: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/launch_command_passed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" > test.res 2 | -Assert files equal: test.res test.ref 3 | -------------------------------------------------------------------------------- /functional_tests/launch_process_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Launched process 'process.sh' returned unexpected exit code 1. More info in launch_0.failure_info 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/launch_process_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/process.sh test/test.toast test.toast report.ref 3 | -Tags: linux 4 | -Description: 5 | GIVEN file test.ref 6 | WHEN launching script process.sh that outputs content of unexistent file test.res 7 | THEN test should fail 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert exit code: 1 11 | -Assert files equal: report.res report.ref 12 | -------------------------------------------------------------------------------- /functional_tests/launch_process_failed/test/process.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cat test.res 3 | -------------------------------------------------------------------------------- /functional_tests/launch_process_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch process: process.sh 2 | -------------------------------------------------------------------------------- /functional_tests/launch_process_failed_windows/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Failure: Launched process 'process.bat' returned unexpected exit code 1. More info in launch_0.failure_info 4 | Result: FAILED 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/launch_process_failed_windows/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/process.bat test/test.toast test.toast report.ref 3 | -Tags: windows 4 | -Description: 5 | GIVEN file test.ref 6 | WHEN launching script process.sh that outputs content of unexistent file test.res 7 | THEN test should fail 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -shell='msys2 -c' 10 | -Assert exit code: 1 11 | -Assert files equal: report.res report.ref 12 | -------------------------------------------------------------------------------- /functional_tests/launch_process_failed_windows/test/process.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | type test.res 3 | -------------------------------------------------------------------------------- /functional_tests/launch_process_failed_windows/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch process: process.bat 2 | -------------------------------------------------------------------------------- /functional_tests/launch_process_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/launch_process_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/process.sh test/test.ref test/test.toast test.toast report.ref 3 | -Tags: linux 4 | -Description: 5 | GIVEN file test.ref 6 | WHEN launching script process.sh that outputs content of test.ref to file test.res and assert that files are equal 7 | THEN test should pass 8 | --- 9 | -Launch: rm test/test.res 10 | -Assert exit code: * 11 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 12 | -Assert files equal: report.res report.ref 13 | -------------------------------------------------------------------------------- /functional_tests/launch_process_passed/test/process.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "Hello world" > test.res 3 | -------------------------------------------------------------------------------- /functional_tests/launch_process_passed/test/test.ref: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/launch_process_passed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch process: process.sh 2 | -Assert files equal: test.res test.ref 3 | -------------------------------------------------------------------------------- /functional_tests/launch_process_passed_windows/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/launch_process_passed_windows/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/process.bat test/test.ref test/test.toast test.toast report.ref 3 | -Tags: windows 4 | -Description: 5 | GIVEN file test.ref 6 | WHEN launching script process.sh that outputs content of test.ref to file test.res and assert that files are equal 7 | THEN test should pass 8 | --- 9 | -Launch: rm test/test.res 10 | -Assert exit code: * 11 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 12 | -Assert files equal: report.res report.ref 13 | -------------------------------------------------------------------------------- /functional_tests/launch_process_passed_windows/test/process.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Hello world > test.res 3 | -------------------------------------------------------------------------------- /functional_tests/launch_process_passed_windows/test/test.ref: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/launch_process_passed_windows/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch process: process.bat 2 | -Assert files equal: test.res test.ref 3 | -------------------------------------------------------------------------------- /functional_tests/launch_unchecked_command/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/launch_unchecked_command/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test.toast report.ref 3 | -Description: 4 | GIVEN file test.ref 5 | WHEN launching unchecked shell command that outputs content of unexistent file test.res, 6 | THEN test should pass 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup ${{shellParam}} 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/launch_unchecked_command/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: cat test.res 2 | -Assert exit code: * 3 | -------------------------------------------------------------------------------- /functional_tests/launch_unchecked_process/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/launch_unchecked_process/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/process.sh test/test.toast test.toast report.ref 3 | -Tags: linux 4 | -Description: 5 | GIVEN file test.ref 6 | WHEN launching unchecked script process.sh that outputs content of unexistent file test.res, 7 | THEN test should pass 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/launch_unchecked_process/test/process.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cat test.res 3 | -------------------------------------------------------------------------------- /functional_tests/launch_unchecked_process/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch process: process.sh 2 | -Assert exit code: * 3 | -------------------------------------------------------------------------------- /functional_tests/launch_unchecked_process_windows/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/launch_unchecked_process_windows/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/process.bat test/test.toast test.toast report.ref 3 | -Tags: windows 4 | -Description: 5 | GIVEN file test.ref 6 | WHEN launching unchecked script process.sh that outputs content of unexistent file test.res, 7 | THEN test should pass 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/launch_unchecked_process_windows/test/process.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | type test.res 3 | -------------------------------------------------------------------------------- /functional_tests/launch_unchecked_process_windows/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch process: process.bat 2 | -Assert exit code: * 3 | -------------------------------------------------------------------------------- /functional_tests/launch_unexistent_process_error/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Couldn't find the executable of a command 'process.sh' 4 | Result: ERROR 5 | 6 | ################## SUMMARY ################### 7 | Default: 0 out of 1 passed, 1 failed 8 | --- 9 | Total: 0 out of 1 passed, 1 failed 10 | -------------------------------------------------------------------------------- /functional_tests/launch_unexistent_process_error/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: errors 3 | -Contents: test test/test.toast test.toast report.ref 4 | -Description: 5 | GIVEN file test.ref 6 | WHEN launching unexistent script process.sh 7 | THEN test should fail 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert exit code: 1 11 | -Assert files equal: report.res report.ref 12 | -------------------------------------------------------------------------------- /functional_tests/launch_unexistent_process_error/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch process: process.sh 2 | -------------------------------------------------------------------------------- /functional_tests/linux_vars.shoal: -------------------------------------------------------------------------------- 1 | #vars: 2 | shellParam = '' -------------------------------------------------------------------------------- /functional_tests/list_failed/failed_tests.ref: -------------------------------------------------------------------------------- 1 | functional_tests/list_failed/test/failed 2 | functional_tests/list_failed/test/failed2 3 | -------------------------------------------------------------------------------- /functional_tests/list_failed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 3 ] ################### 2 | Name: test 3 | Result: PASSED 4 | ################## [ 2 / 3 ] ################### 5 | Name: failed 6 | Failure: Launched process 'unknown_process' returned unexpected exit code 127. More info in launch_0.failure_info 7 | Result: FAILED 8 | ################## [ 3 / 3 ] ################### 9 | Name: failed2 10 | Failure: Launched process 'unknown_process' returned unexpected exit code 127. More info in launch_0.failure_info 11 | Result: FAILED 12 | 13 | ################## SUMMARY ################### 14 | Default: 1 out of 3 passed, 2 failed 15 | --- 16 | Total: 1 out of 3 passed, 2 failed 17 | -------------------------------------------------------------------------------- /functional_tests/list_failed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.ref} 3 | -Description: 4 | GIVEN 2 different files (lhs.txt and rhs.txt) and 2 different files (lhs2.txt rhs2.txt) 5 | WHEN test two expectations of files equality 6 | THEN first expectation should fail, second expectation should fail, after that the test should fail 7 | --- 8 | -Launch: ../../build/lunchtoast ./test -reportFile=report.res --withoutCleanup -listFailedTests=failed_tests.txt ${{shellParam}} 9 | -Assert exit code: 1 10 | -Launch: sed -i 's/.*functional_tests/functional_tests/' failed_tests.txt 11 | -Assert files equal: report.res report.ref 12 | -Assert files equal: failed_tests.txt failed_tests.ref 13 | -------------------------------------------------------------------------------- /functional_tests/list_failed/test/failed/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: unknown_process 2 | -------------------------------------------------------------------------------- /functional_tests/list_failed/test/failed2/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: unknown_process 2 | -------------------------------------------------------------------------------- /functional_tests/list_failed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_enabled/report.ref: -------------------------------------------------------------------------------- 1 | ######### invalid assertions [ 1 / 1 ] ######### 2 | Name: test3 3 | Result: DISABLED 4 | ########## valid assertions [ 1 / 2 ] ########## 5 | Name: test 6 | Result: PASSED 7 | ########## valid assertions [ 2 / 2 ] ########## 8 | Name: test2 9 | Result: DISABLED 10 | 11 | ################## SUMMARY ################### 12 | invalid assertions: 0 out of 1 passed, 0 failed, 1 disabled 13 | valid assertions: 1 out of 2 passed, 0 failed, 1 disabled 14 | --- 15 | Total: 1 out of 3 passed, 0 failed, 2 disabled 16 | -------------------------------------------------------------------------------- /functional_tests/multiple_enabled/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: {.*\.txt} report.ref 4 | -Description: 5 | GIVEN 2 equal files lhs.txt and rhs.txt and different file rhs2.txt 6 | WHEN 2 tests in the suite "valid assertions" check equality of lhs.txt and rhs.txt, one of them is disabled 7 | 1 disabled test in the suite "invalid assertions" check equality of lhs.txt and rhs2.txt, 8 | THEN one test from the suite "valid assertions" should pass, 9 | other tests shouldn't run because they are disabled 10 | disabled tests counters should be in the report 11 | --- 12 | -Launch unchecked: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 13 | -Assert files equal: report.res report.ref 14 | -------------------------------------------------------------------------------- /functional_tests/multiple_enabled/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_enabled/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_enabled/test/test.toast: -------------------------------------------------------------------------------- 1 | -Suite: valid assertions 2 | -Enabled: true 3 | -Assert files equal: lhs.txt rhs.txt 4 | -------------------------------------------------------------------------------- /functional_tests/multiple_enabled/test/test2/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_enabled/test/test2/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_enabled/test/test2/test.toast: -------------------------------------------------------------------------------- 1 | -Suite: valid assertions 2 | -Enabled: false 3 | -Assert files equal: lhs.txt rhs.txt 4 | -------------------------------------------------------------------------------- /functional_tests/multiple_enabled/test/test3/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_enabled/test/test3/rhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_enabled/test/test3/test.toast: -------------------------------------------------------------------------------- 1 | -Suite: invalid assertions 2 | -Enabled: false 3 | -Assert files equal: lhs.txt rhs2.txt 4 | -------------------------------------------------------------------------------- /functional_tests/multiple_suites/report.ref: -------------------------------------------------------------------------------- 1 | ######### invalid assertions [ 1 / 1 ] ######### 2 | Name: test3 3 | Failure: Files lhs.txt and rhs2.txt aren't equal 4 | Result: FAILED 5 | ########## valid assertions [ 1 / 2 ] ########## 6 | Name: test 7 | Result: PASSED 8 | ########## valid assertions [ 2 / 2 ] ########## 9 | Name: test2 10 | Result: PASSED 11 | 12 | ################## SUMMARY ################### 13 | invalid assertions: 0 out of 1 passed, 1 failed 14 | valid assertions: 2 out of 2 passed, 0 failed 15 | --- 16 | Total: 2 out of 3 passed, 1 failed 17 | -------------------------------------------------------------------------------- /functional_tests/multiple_suites/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: {.*\.txt} report.ref 4 | -Description: 5 | GIVEN 2 equal files lhs.txt and rhs.txt and different file rhs2.txt 6 | WHEN 2 tests in the suite "valid assertions" check equality of lhs.txt and rhs.txt, 7 | 1 test in the suite "invalid assertions" check equality of lhs.txt and rhs2.txt, 8 | THEN tests from the suite "valid assertions" should pass, 9 | a test from the suite "invalid assertions" should fail, 10 | both suites should be in the report 11 | --- 12 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 13 | -Assert exit code: 1 14 | -Assert files equal: report.res report.ref 15 | -------------------------------------------------------------------------------- /functional_tests/multiple_suites/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_suites/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_suites/test/test.toast: -------------------------------------------------------------------------------- 1 | -Suite: valid assertions 2 | -Assert files equal: lhs.txt rhs.txt 3 | -------------------------------------------------------------------------------- /functional_tests/multiple_suites/test/test2/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_suites/test/test2/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_suites/test/test2/test.toast: -------------------------------------------------------------------------------- 1 | -Suite: valid assertions 2 | -Assert files equal: lhs.txt rhs.txt 3 | -------------------------------------------------------------------------------- /functional_tests/multiple_suites/test/test3/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_suites/test/test3/rhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/multiple_suites/test/test3/test.toast: -------------------------------------------------------------------------------- 1 | -Suite: invalid assertions 2 | -Assert files equal: lhs.txt rhs2.txt 3 | -------------------------------------------------------------------------------- /functional_tests/set_cleanup/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/set_cleanup/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref 3 | -Description: 4 | GIVEN 2 equal files (lhs.txt (inside folder data) and rhs.txt) 5 | WHEN don't disable cleanup of files created during testing, test single assertion of files equality, write file test.txt, make directory tmp and write file tmp/test.txt 6 | THEN test should pass, file test.txt should be removed, directory tmp should be removed 7 | --- 8 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res ${{shellParam}} 9 | -Launch: find test | sort > testdir.res 10 | -Assert testdir.res: 11 | test 12 | test/data 13 | test/data/lhs.txt 14 | test/rhs.txt 15 | test/test.toast 16 | 17 | --- 18 | -Assert files equal: report.res report.ref 19 | -------------------------------------------------------------------------------- /functional_tests/set_cleanup/test/data/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_cleanup/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_cleanup/test/test.toast: -------------------------------------------------------------------------------- 1 | -Contents: data/lhs.txt rhs.txt 2 | -Write test.txt: 3 | Hello world 4 | --- 5 | -Assert test.txt: 6 | Hello world 7 | --- 8 | -Launch command: mkdir tmp 9 | -Launch command: echo "Hello world" > tmp/test.txt 10 | -Assert tmp/test.txt: 11 | Hello world 12 | 13 | --- 14 | -Assert files equal: data/lhs.txt rhs.txt 15 | -------------------------------------------------------------------------------- /functional_tests/set_contents/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/set_contents/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/data2 test/data2/inner test/data2/inner/preserved.txt test/data2/lhs.txt test/data2/rhs.txt test/test.toast test/data test/data/lhs.txt test/rhs.txt test.toast report.ref 3 | -Tags: linux 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt (inside folder data) and rhs.txt), and 2 equal files inside folder data2, and text file data2/inner/preserved.txt 6 | WHEN enable cleanup of files created during testing, test single assertion of files equality, write file test.txt, make directory tmp and write file tmp/test.txt 7 | THEN test should pass, file test.txt should be removed, directory tmp should be removed 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res 10 | -Launch: find test | sort -d > dir.res 11 | -Assert dir.res: 12 | test 13 | test/data 14 | test/data2 15 | test/data2/inner 16 | test/data2/inner/preserved.txt 17 | test/data2/lhs.txt 18 | test/data2/rhs.txt 19 | test/data/lhs.txt 20 | test/rhs.txt 21 | test/test.toast 22 | 23 | --- 24 | -Assert files equal: report.res report.ref 25 | -------------------------------------------------------------------------------- /functional_tests/set_contents/test/data/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_contents/test/data2/inner/preserved.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamchatka-volcano/lunchtoast/6202af9744d759556d238ba54f957229c452b39c/functional_tests/set_contents/test/data2/inner/preserved.txt -------------------------------------------------------------------------------- /functional_tests/set_contents/test/data2/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_contents/test/data2/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_contents/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_contents/test/test.toast: -------------------------------------------------------------------------------- 1 | -Contents: data/lhs.txt rhs.txt {data2/.*} 2 | -Write test.txt: 3 | Hello world 4 | --- 5 | -Assert test.txt: 6 | Hello world 7 | --- 8 | -Launch command: mkdir tmp 9 | -Launch command: echo "Hello world" > tmp/test.txt 10 | -Launch command: echo "Hello world" > data/test.txt 11 | -Assert tmp/test.txt: 12 | Hello world 13 | 14 | --- 15 | -Assert data/test.txt: 16 | Hello world 17 | 18 | --- 19 | -Assert files equal: data/lhs.txt rhs.txt 20 | -Assert files equal: data2/lhs.txt data2/rhs.txt 21 | -------------------------------------------------------------------------------- /functional_tests/set_contents_windows/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/set_contents_windows/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/data2 test/data2/inner test/data2/inner/preserved.txt test/data2/lhs.txt test/data2/rhs.txt test/test.toast test/data test/data/lhs.txt test/rhs.txt test.toast report.ref 3 | -Tags: windows 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt (inside folder data) and rhs.txt), and 2 equal files inside folder data2, and text file data2/inner/preserved.txt 6 | WHEN enable cleanup of files created during testing, test single assertion of files equality, write file test.txt, make directory tmp and write file tmp/test.txt 7 | THEN test should pass, file test.txt should be removed, directory tmp should be removed 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res -shell='msys2 -c' 10 | -Launch: find test | sort > dir.res 11 | -Assert dir.res: 12 | test 13 | test/data 14 | test/data/lhs.txt 15 | test/data2 16 | test/data2/inner 17 | test/data2/inner/preserved.txt 18 | test/data2/lhs.txt 19 | test/data2/rhs.txt 20 | test/rhs.txt 21 | test/test.toast 22 | 23 | --- 24 | -Assert files equal: report.res report.ref 25 | -------------------------------------------------------------------------------- /functional_tests/set_contents_windows/test/data/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_contents_windows/test/data2/inner/preserved.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamchatka-volcano/lunchtoast/6202af9744d759556d238ba54f957229c452b39c/functional_tests/set_contents_windows/test/data2/inner/preserved.txt -------------------------------------------------------------------------------- /functional_tests/set_contents_windows/test/data2/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_contents_windows/test/data2/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_contents_windows/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_contents_windows/test/test.toast: -------------------------------------------------------------------------------- 1 | -Contents: data/lhs.txt rhs.txt {data2/.*} 2 | -Write test.txt: 3 | Hello world 4 | --- 5 | -Assert test.txt: 6 | Hello world 7 | --- 8 | -Launch command: mkdir tmp 9 | -Launch command: echo "Hello world" > tmp/test.txt 10 | -Launch command: echo "Hello world" > data/test.txt 11 | -Assert tmp/test.txt: 12 | Hello world 13 | 14 | --- 15 | -Assert data/test.txt: 16 | Hello world 17 | 18 | --- 19 | -Assert files equal: data/lhs.txt rhs.txt 20 | -Assert files equal: data2/lhs.txt data2/rhs.txt 21 | -------------------------------------------------------------------------------- /functional_tests/set_description/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Description: two files equality assertions, test should fail on the first one 4 | Failure: Files lhs.txt and rhs.txt aren't equal 5 | Result: FAILED 6 | 7 | ################## SUMMARY ################### 8 | Default: 0 out of 1 passed, 1 failed 9 | --- 10 | Total: 0 out of 1 passed, 1 failed 11 | -------------------------------------------------------------------------------- /functional_tests/set_description/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: test test/lhs2.txt test/lhs.txt test/rhs2.txt test/test.toast test/rhs.txt test.toast report.ref 4 | -Description: 5 | GIVEN 2 different files (lhs.txt and rhs.txt) and 2 different files (lhs2.txt and rhs2.txt), test has a description 6 | WHEN test assertion of lhs.txt and rhs.txt equality, test assertion of lhs2.txt and rhs2.txt equality 7 | THEN first assertion should fail, test should fail after the first assertion without checking the second one, the test description should be in the report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert exit code: 1 11 | -Assert files equal: report.res report.ref 12 | -------------------------------------------------------------------------------- /functional_tests/set_description/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_description/test/lhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_description/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/set_description/test/rhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/set_description/test/test.toast: -------------------------------------------------------------------------------- 1 | -Description: two files equality assertions, test should fail on the first one 2 | -Assert files equal: lhs.txt rhs.txt 3 | -Assert files equal: lhs2.txt rhs2.txt 4 | -------------------------------------------------------------------------------- /functional_tests/set_description_with_vars/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Description: two files equality assertions, test should fail on the first one (directory - test) 4 | Failure: Files lhs.txt and rhs.txt aren't equal 5 | Result: FAILED 6 | 7 | ################## SUMMARY ################### 8 | Default: 0 out of 1 passed, 1 failed 9 | --- 10 | Total: 0 out of 1 passed, 1 failed 11 | -------------------------------------------------------------------------------- /functional_tests/set_description_with_vars/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: test test/lhs2.txt test/lhs.txt test/rhs2.txt test/test.toast test/rhs.txt test.toast report.ref 4 | -Description: 5 | GIVEN 2 different files (lhs.txt and rhs.txt) and 2 different files (lhs2.txt and rhs2.txt), test has a description using a built-in variable ${{ DIR }} 6 | WHEN test assertion of lhs.txt and rhs.txt equality, test assertion of lhs2.txt and rhs2.txt equality 7 | THEN first assertion should fail, test should fail after the first assertion without checking the second one, test description should be in the report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert exit code: 1 11 | -Assert files equal: report.res report.ref 12 | -------------------------------------------------------------------------------- /functional_tests/set_description_with_vars/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_description_with_vars/test/lhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_description_with_vars/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/set_description_with_vars/test/rhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/set_description_with_vars/test/test.toast: -------------------------------------------------------------------------------- 1 | -Description: two files equality assertions, test should fail on the first one (directory - ${{ DIR }}) 2 | -Assert files equal: lhs.txt rhs.txt 3 | -Assert files equal: lhs2.txt rhs2.txt 4 | -------------------------------------------------------------------------------- /functional_tests/set_enabled/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: DISABLED 4 | 5 | ################## SUMMARY ################### 6 | Default: 0 out of 1 passed, 0 failed, 1 disabled 7 | --- 8 | Total: 0 out of 1 passed, 0 failed, 1 disabled 9 | -------------------------------------------------------------------------------- /functional_tests/set_enabled/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: test test/lhs.txt test/test.toast test/rhs.txt test.toast report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt), set enabled false 6 | WHEN test single assertion of files equality 7 | THEN test shouldn't start because it's disabled, disabled test counter should be in report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/set_enabled/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_enabled/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_enabled/test/test.toast: -------------------------------------------------------------------------------- 1 | -Enabled: false 2 | -Assert files equal: lhs.txt rhs.txt 3 | -------------------------------------------------------------------------------- /functional_tests/set_multiline_description/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Description: 4 | two files equality assertions, 5 | test should fail on the first one 6 | Failure: Files lhs.txt and rhs.txt aren't equal 7 | Result: FAILED 8 | 9 | ################## SUMMARY ################### 10 | Default: 0 out of 1 passed, 1 failed 11 | --- 12 | Total: 0 out of 1 passed, 1 failed 13 | -------------------------------------------------------------------------------- /functional_tests/set_multiline_description/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: test test/lhs2.txt test/lhs.txt test/rhs2.txt test/test.toast test/rhs.txt test.toast report.ref 4 | -Description: 5 | GIVEN 2 different files (lhs.txt and rhs.txt) and 2 different files (lhs2.txt and rhs2.txt), test has a description 6 | WHEN test assertion of lhs.txt and rhs.txt equality, test assertion of lhs2.txt and rhs2.txt equality 7 | THEN first assertion should fail, test should fail after the first assertion without checking the second one, test description should be in the report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert exit code: 1 11 | -Assert files equal: report.res report.ref 12 | -------------------------------------------------------------------------------- /functional_tests/set_multiline_description/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_multiline_description/test/lhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_multiline_description/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/set_multiline_description/test/rhs2.txt: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/set_multiline_description/test/test.toast: -------------------------------------------------------------------------------- 1 | -Description: 2 | two files equality assertions, 3 | test should fail on the first one 4 | --- 5 | -Assert files equal: lhs.txt rhs.txt 6 | -Assert files equal: lhs2.txt rhs2.txt 7 | -------------------------------------------------------------------------------- /functional_tests/set_name/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: Files equality assertion 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/set_name/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: test test/lhs.txt test/test.toast test/rhs.txt test.toast report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt), set test name 6 | WHEN test single assertion of files equality 7 | THEN test should pass, test name should be in report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/set_name/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_name/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_name/test/test.toast: -------------------------------------------------------------------------------- 1 | -Name: Files equality assertion 2 | -Assert files equal: lhs.txt rhs.txt 3 | -------------------------------------------------------------------------------- /functional_tests/set_name_with_vars/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: Files equality assertion (directory - test) 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/set_name_with_vars/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: test test/lhs.txt test/test.toast test/rhs.txt test.toast report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt), set test name using a built-in variables ${{ DIR }} 6 | WHEN test single assertion of files equality 7 | THEN test should pass, test name should be in report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/set_name_with_vars/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_name_with_vars/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_name_with_vars/test/test.toast: -------------------------------------------------------------------------------- 1 | -Name: Files equality assertion (directory - ${{ DIR }}) 2 | -Assert files equal: lhs.txt rhs.txt 3 | -------------------------------------------------------------------------------- /functional_tests/set_shell_command/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/set_shell_command/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: test test/test.ref test/test.toast test.toast report.ref 4 | -Tags: linux 5 | -Description: 6 | GIVEN file test.ref 7 | WHEN specify shell command as "bash -c", launch shell command that outputs content of test.ref to file test.res and assert that files are equal 8 | THEN test should pass 9 | --- 10 | -Launch: rm test/test.res 11 | -Assert exit code: * 12 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -shell="bash -c" 13 | -Assert files equal: report.res report.ref 14 | -------------------------------------------------------------------------------- /functional_tests/set_shell_command/test/test.ref: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_shell_command/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch command: echo "Hello world" > test.res 2 | -Assert files equal: test.res test.ref 3 | -------------------------------------------------------------------------------- /functional_tests/set_shell_command_windows/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/set_shell_command_windows/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: test test/test.ref test/test.toast test.toast report.ref 4 | -Tags: windows 5 | -Description: 6 | GIVEN file test.ref 7 | WHEN specify shell command as "powershell -c", launch shell command that outputs content of test.ref to file test.res and assert that files are equal 8 | THEN test should pass 9 | --- 10 | -Launch: rm test/test.res 11 | -Assert exit code: * 12 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -shell='powershell -c' 13 | -Assert files equal: report.res report.ref 14 | -------------------------------------------------------------------------------- /functional_tests/set_shell_command_windows/test/test.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamchatka-volcano/lunchtoast/6202af9744d759556d238ba54f957229c452b39c/functional_tests/set_shell_command_windows/test/test.ref -------------------------------------------------------------------------------- /functional_tests/set_shell_command_windows/test/test.toast: -------------------------------------------------------------------------------- 1 | -Launch command: echo 'Hello world' > test.res 2 | -Assert files equal: test.res test.ref 3 | -------------------------------------------------------------------------------- /functional_tests/set_suite/report.ref: -------------------------------------------------------------------------------- 1 | ############# assertions [ 1 / 1 ] ############# 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | assertions: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/set_suite/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: test test/lhs.txt test/test.toast test/rhs.txt test.toast report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt), set suite name 6 | WHEN test single assertion of files equality 7 | THEN test should pass, suite name should be in report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/set_suite/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_suite/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_suite/test/test.toast: -------------------------------------------------------------------------------- 1 | -Suite: assertions 2 | -Assert files equal: lhs.txt rhs.txt 3 | -------------------------------------------------------------------------------- /functional_tests/set_suite_with_vars/report.ref: -------------------------------------------------------------------------------- 1 | ########### directory test [ 1 / 1 ] ########### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | directory test: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/set_suite_with_vars/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: test test/lhs.txt test/test.toast test/rhs.txt test.toast report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt), set suite name using a built-in variable ${{ DIR }} 6 | WHEN test single assertion of files equality 7 | THEN test should pass, suite name should be in report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/set_suite_with_vars/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_suite_with_vars/test/rhs.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/set_suite_with_vars/test/test.toast: -------------------------------------------------------------------------------- 1 | -Suite: directory ${{ DIR }} 2 | -Assert files equal: lhs.txt rhs.txt 3 | -------------------------------------------------------------------------------- /functional_tests/set_tag_variables/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 3 ] ################### 2 | Name: test_0 3 | Result: PASSED 4 | ################## [ 2 / 3 ] ################### 5 | Name: test_1 6 | Result: PASSED 7 | ################## [ 3 / 3 ] ################### 8 | Name: test_2 9 | Result: PASSED 10 | 11 | ################## SUMMARY ################### 12 | Default: 3 out of 3 passed, 0 failed 13 | --- 14 | Total: 3 out of 3 passed, 0 failed 15 | -------------------------------------------------------------------------------- /functional_tests/set_tag_variables/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref vars.cfg 3 | -Description: 4 | GIVEN 2 equal files (lhs.txt and rhs.txt) 5 | WHEN test single assertion of files equality 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=vars.cfg 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/set_tag_variables/test/test_0/0.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/set_tag_variables/test/test_0/test.toast: -------------------------------------------------------------------------------- 1 | -Contents: {.*\.txt} 2 | -Assert 0.txt: 3 | Hello ${{greetName}} 4 | --- -------------------------------------------------------------------------------- /functional_tests/set_tag_variables/test/test_1/1.txt: -------------------------------------------------------------------------------- 1 | Hello moon -------------------------------------------------------------------------------- /functional_tests/set_tag_variables/test/test_1/test.toast: -------------------------------------------------------------------------------- 1 | -Contents: {.*\.txt} 2 | -Tags: first 3 | -Assert 1.txt: 4 | Hello ${{greetName}} 5 | --- 6 | -------------------------------------------------------------------------------- /functional_tests/set_tag_variables/test/test_2/2.txt: -------------------------------------------------------------------------------- 1 | Hello pluto -------------------------------------------------------------------------------- /functional_tests/set_tag_variables/test/test_2/test.toast: -------------------------------------------------------------------------------- 1 | -Contents: {.*\.txt} 2 | -Tags: second 3 | -Assert 2.txt: 4 | Hello ${{greetName}} 5 | --- 6 | -------------------------------------------------------------------------------- /functional_tests/set_tag_variables/vars.cfg: -------------------------------------------------------------------------------- 1 | #vars: 2 | greetName = world 3 | --- 4 | 5 | #tagVars: 6 | ### 7 | tag = first 8 | #vars: 9 | greetName = moon 10 | ### 11 | tag = second 12 | #vars: 13 | greetName = pluto 14 | -------------------------------------------------------------------------------- /functional_tests/set_variables/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/set_variables/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref vars.cfg 3 | -Description: 4 | GIVEN 2 files lhs.txt and multiline.txt 5 | WHEN test that text of lhs.txt is equal to variable 'greetName' and text of multiline.txt is equal to variable 'multilineText' 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -config=vars.cfg 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/set_variables/test/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/set_variables/test/multiline.txt: -------------------------------------------------------------------------------- 1 | Hello Test 2 | Multiline -------------------------------------------------------------------------------- /functional_tests/set_variables/test/test.toast: -------------------------------------------------------------------------------- 1 | -Assert lhs.txt: 2 | Hello ${{greetName}} 3 | --- 4 | -Assert multiline.txt: 5 | Hello ${{multilineText}} 6 | --- -------------------------------------------------------------------------------- /functional_tests/set_variables/vars.cfg: -------------------------------------------------------------------------------- 1 | #vars: 2 | greetName = world 3 | multilineText = " 4 | Test 5 | Multiline" -------------------------------------------------------------------------------- /functional_tests/set_variables_merge/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: subtest 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/set_variables_merge/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {.*\.txt} report.ref 3 | -Description: 4 | GIVEN 2 files lhs.txt and multiline.txt 5 | WHEN test that text of lhs.txt is equal to variable 'greetName' and text of multiline.txt is equal to variable 'multilineText' 6 | THEN test should pass 7 | --- 8 | -Launch: ../../build/lunchtoast ./test -reportFile=report.res --withoutCleanup 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/set_variables_merge/test/lunchtoast.cfg: -------------------------------------------------------------------------------- 1 | #vars: 2 | greetName = moon 3 | multilineText = " 4 | Test 5 | Multiline" -------------------------------------------------------------------------------- /functional_tests/set_variables_merge/test/subtest/lhs.txt: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/set_variables_merge/test/subtest/lunchtoast.cfg: -------------------------------------------------------------------------------- 1 | #vars: 2 | greetName = world -------------------------------------------------------------------------------- /functional_tests/set_variables_merge/test/subtest/multiline.txt: -------------------------------------------------------------------------------- 1 | Hello Test 2 | Multiline -------------------------------------------------------------------------------- /functional_tests/set_variables_merge/test/subtest/test.toast: -------------------------------------------------------------------------------- 1 | -Assert lhs.txt: 2 | Hello ${{greetName}} 3 | --- 4 | -Assert multiline.txt: 5 | Hello ${{multilineText}} 6 | --- -------------------------------------------------------------------------------- /functional_tests/tag_select/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test_first 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/tag_select/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt), set enabled false 6 | WHEN test single assertion of files equality 7 | THEN test shouldn't start because it's disabled, disabled test counter should be in report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -select=world ${{shellParam}} 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/tag_select/test/test_first/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" 2 | -Tags: world -------------------------------------------------------------------------------- /functional_tests/tag_select/test/test_second/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello moon" 2 | -Tags: moon -------------------------------------------------------------------------------- /functional_tests/tag_select_multi/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 2 ] ################### 2 | Name: test_first 3 | Result: PASSED 4 | ################## [ 2 / 2 ] ################### 5 | Name: test_second 6 | Result: PASSED 7 | 8 | ################## SUMMARY ################### 9 | Default: 2 out of 2 passed, 0 failed 10 | --- 11 | Total: 2 out of 2 passed, 0 failed 12 | -------------------------------------------------------------------------------- /functional_tests/tag_select_multi/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: {.*\.txt} report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt), set enabled false 6 | WHEN test single assertion of files equality 7 | THEN test shouldn't start because it's disabled, disabled test counter should be in report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -select=world,moon ${{shellParam}} 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/tag_select_multi/test/test_first/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" 2 | -Tags: world -------------------------------------------------------------------------------- /functional_tests/tag_select_multi/test/test_second/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello moon" 2 | -Tags: moon -------------------------------------------------------------------------------- /functional_tests/tag_select_multi/test/test_third/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello pluto" 2 | -Tags: pluto -------------------------------------------------------------------------------- /functional_tests/tag_skip/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test_second 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/tag_skip/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt), set enabled false 6 | WHEN test single assertion of files equality 7 | THEN test shouldn't start because it's disabled, disabled test counter should be in report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -skip=world ${{shellParam}} 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/tag_skip/test/test_first/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" 2 | -Tags: world -------------------------------------------------------------------------------- /functional_tests/tag_skip/test/test_second/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello moon" 2 | -Tags: moon -------------------------------------------------------------------------------- /functional_tests/tag_skip_multi/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test_second 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/tag_skip_multi/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: setting params 3 | -Contents: report.ref 4 | -Description: 5 | GIVEN 2 equal files (lhs.txt and rhs.txt), set enabled false 6 | WHEN test single assertion of files equality 7 | THEN test shouldn't start because it's disabled, disabled test counter should be in report 8 | --- 9 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup -skip=world -skip=pluto ${{shellParam}} 10 | -Assert files equal: report.res report.ref 11 | -------------------------------------------------------------------------------- /functional_tests/tag_skip_multi/test/test_first/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello world" 2 | -Tags: world -------------------------------------------------------------------------------- /functional_tests/tag_skip_multi/test/test_second/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello moon" 2 | -Tags: moon -------------------------------------------------------------------------------- /functional_tests/tag_skip_multi/test/test_third/test.toast: -------------------------------------------------------------------------------- 1 | -Launch: echo "Hello pluto" 2 | -Tags: pluto -------------------------------------------------------------------------------- /functional_tests/unicode/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: ланчтост 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/unicode/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: {test/🥸\.txt} test/ланчтост.test test/рхс.txt test.toast report.ref 3 | -Description: 4 | GIVEN 2 equal files (lhs.txt and rhs.txt) 5 | WHEN test single assertion of files equality 6 | THEN test should pass 7 | --- 8 | -Launch process: ../../build/lunchtoast ./test -reportFile=report.res --withoutCleanup ${{shellParam}} 9 | -Assert files equal: report.res report.ref 10 | -------------------------------------------------------------------------------- /functional_tests/unicode/test/test.toast: -------------------------------------------------------------------------------- 1 | -Name: ланчтост 2 | -Assert files equal: 🥸.txt рхс.txt 3 | -Launch: echo "Привет мир!" 4 | -Expect output: 5 | Привет мир! 6 | 7 | --- 8 | -------------------------------------------------------------------------------- /functional_tests/unicode/test/рхс.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/unicode/test/🥸.txt: -------------------------------------------------------------------------------- 1 | Hello world 2 | -------------------------------------------------------------------------------- /functional_tests/windows_vars.shoal: -------------------------------------------------------------------------------- 1 | #vars: 2 | shellParam = '-shell="msys2 -c"' -------------------------------------------------------------------------------- /functional_tests/write_file_failed_error/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: ERROR 4 | 5 | ################## SUMMARY ################### 6 | Default: 0 out of 1 passed, 1 failed 7 | --- 8 | Total: 0 out of 1 passed, 1 failed 9 | -------------------------------------------------------------------------------- /functional_tests/write_file_failed_error/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Suite: errors 3 | -Contents: test test/test.ref test/dir test/dir/tmp test/test.toast test.toast report.ref 4 | -Description: 5 | GIVEN file test.ref and directory dir 6 | WHEN writing file to file 'dir' with the same content as test.ref and assert that files are equal 7 | THEN file writing should fail because directory with the same name exist 8 | --- 9 | -Launch: mkdir ./test/dir 10 | -Assert exit code: * 11 | -Launch: ../../build/lunchtoast test/ | sed '/iostream/d' > report.res 12 | -Assert exit code: 1 13 | -Assert files equal: report.res report.ref 14 | -------------------------------------------------------------------------------- /functional_tests/write_file_failed_error/test/dir/tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamchatka-volcano/lunchtoast/6202af9744d759556d238ba54f957229c452b39c/functional_tests/write_file_failed_error/test/dir/tmp -------------------------------------------------------------------------------- /functional_tests/write_file_failed_error/test/test.ref: -------------------------------------------------------------------------------- 1 | Hello world -------------------------------------------------------------------------------- /functional_tests/write_file_failed_error/test/test.toast: -------------------------------------------------------------------------------- 1 | -Contents: dir/tmp test.ref 2 | -Write dir: 3 | Hello world 4 | --- 5 | -Assert files equal: dir test.ref 6 | -------------------------------------------------------------------------------- /functional_tests/write_file_passed/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/write_file_passed/test.ref: -------------------------------------------------------------------------------- 1 | Hello world 2 | - Yes 3 | # No -------------------------------------------------------------------------------- /functional_tests/write_file_passed/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test.ref test2.ref test.toast report.ref 3 | -Description: 4 | GIVEN file test.ref 5 | WHEN writing file test.res with the same content as test.ref and assert that files are equal 6 | THEN test should pass 7 | --- 8 | -Launch: rm test/test.res 9 | -Assert exit code: * 10 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 11 | -Assert files equal: report.res report.ref 12 | -Assert files equal: test/test.res test.ref 13 | -Assert files equal: test/test2.res test2.ref 14 | -------------------------------------------------------------------------------- /functional_tests/write_file_passed/test/test.toast: -------------------------------------------------------------------------------- 1 | -Write test.res: 2 | Hello world 3 | - Yes 4 | # No 5 | --- 6 | #Write second file 7 | -Write test2.res: 8 | Hello world2 9 | 10 | --- -------------------------------------------------------------------------------- /functional_tests/write_file_passed/test2.ref: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /functional_tests/write_file_passed_custom_separator/report.ref: -------------------------------------------------------------------------------- 1 | ################## [ 1 / 1 ] ################### 2 | Name: test 3 | Result: PASSED 4 | 5 | ################## SUMMARY ################### 6 | Default: 1 out of 1 passed, 0 failed 7 | --- 8 | Total: 1 out of 1 passed, 0 failed 9 | -------------------------------------------------------------------------------- /functional_tests/write_file_passed_custom_separator/test.ref: -------------------------------------------------------------------------------- 1 | Hello world 2 | - Yes 3 | # No -------------------------------------------------------------------------------- /functional_tests/write_file_passed_custom_separator/test.toast: -------------------------------------------------------------------------------- 1 | 2 | -Contents: test test/test.toast test.ref test2.ref test.toast report.ref 3 | -Description: 4 | GIVEN file test.ref 5 | WHEN writing file test.res with the same content as test.ref and assert that files are equal 6 | THEN test should pass 7 | --- 8 | -Launch: rm test/test.res 9 | -Assert exit code: * 10 | -Launch: ../../build/lunchtoast test/ -reportFile=report.res --withoutCleanup 11 | -Assert files equal: report.res report.ref 12 | -Assert files equal: test/test.res test.ref 13 | -Assert files equal: test/test2.res test2.ref 14 | -------------------------------------------------------------------------------- /functional_tests/write_file_passed_custom_separator/test/test.toast: -------------------------------------------------------------------------------- 1 | -Section separator: ---lunchtoast 2 | 3 | -Write test.res: 4 | Hello world 5 | - Yes 6 | # No 7 | ---lunchtoast 8 | 9 | #Write second file 10 | -Write test2.res: 11 | Hello world2 12 | 13 | ---lunchtoast -------------------------------------------------------------------------------- /functional_tests/write_file_passed_custom_separator/test2.ref: -------------------------------------------------------------------------------- 1 | Hello world2 2 | -------------------------------------------------------------------------------- /src/comparefilecontent.cpp: -------------------------------------------------------------------------------- 1 | #include "comparefilecontent.h" 2 | #include "constants.h" 3 | #include "utils.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace lunchtoast { 11 | namespace fs = std::filesystem; 12 | 13 | CompareFileContent::CompareFileContent( 14 | fs::path filePath, 15 | std::string expectedFileContent, 16 | fs::path workingDir, 17 | int actionIndex) 18 | : filePath_{std::move(filePath)} 19 | , expectedFileContent_{std::move(expectedFileContent)} 20 | , workingDir_{std::move(workingDir)} 21 | , actionIndex_{actionIndex} 22 | { 23 | expectedFileContent_ = sfun::replace(expectedFileContent_, "\r\n", "\n"); 24 | expectedFileContent_ = sfun::replace(expectedFileContent_, "\r", "\n"); 25 | } 26 | 27 | namespace { 28 | std::string failureReportFilename(int actionIndex) 29 | { 30 | return fmt::format(hardcoded::compareFileContentFailureReportFilename, actionIndex); 31 | } 32 | 33 | std::string generateComparisonFailureReport( 34 | std::string_view fileName, 35 | std::string_view fileContent, 36 | std::string_view expectedFileContent) 37 | { 38 | return fmt::format( 39 | "-File: {}\n-Content:\n{}---\n-Expected content:\n{}---\n", 40 | fileName, 41 | fileContent.empty() ? "" : std::string{fileContent} + "\n", 42 | expectedFileContent.empty() ? "" : std::string{expectedFileContent} + "\n"); 43 | } 44 | 45 | } //namespace 46 | 47 | TestActionResult CompareFileContent::operator()() const 48 | { 49 | if (!fs::exists(filePath_)) 50 | return TestActionResult::Failure(fmt::format( 51 | "File content check has failed: {} doesn't exist", 52 | sfun::path_string(filePath_.filename()))); 53 | 54 | const auto fileContent = readTextFile(filePath_); 55 | if (fileContent != expectedFileContent_) { 56 | if (expectedFileContent_.find('\n') != std::string::npos) { 57 | auto failureReportFile = std::ofstream{workingDir_ / failureReportFilename(actionIndex_)}; 58 | failureReportFile << generateComparisonFailureReport( 59 | sfun::path_string(filePath_), 60 | fileContent, 61 | expectedFileContent_); 62 | return TestActionResult::Failure(fmt::format( 63 | "File {} content isn't equal to the expected string. More info in {}", 64 | sfun::path_string(filePath_.filename()), 65 | failureReportFilename(actionIndex_))); 66 | } 67 | else 68 | return TestActionResult::Failure(fmt::format( 69 | "File {} content isn't equal to the expected string '{}'", 70 | sfun::path_string(filePath_.filename()), 71 | expectedFileContent_)); 72 | } 73 | 74 | return TestActionResult::Success(); 75 | } 76 | 77 | } //namespace lunchtoast 78 | -------------------------------------------------------------------------------- /src/comparefilecontent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "testactionresult.h" 3 | #include 4 | 5 | namespace lunchtoast { 6 | 7 | class CompareFileContent { 8 | public: 9 | CompareFileContent( 10 | std::filesystem::path filePath, 11 | std::string expectedFileContent, 12 | std::filesystem::path workingDir, 13 | int actionIndex); 14 | TestActionResult operator()() const; 15 | 16 | private: 17 | std::filesystem::path filePath_; 18 | std::string expectedFileContent_; 19 | std::filesystem::path workingDir_; 20 | int actionIndex_; 21 | }; 22 | 23 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/comparefiles.cpp: -------------------------------------------------------------------------------- 1 | #include "comparefiles.h" 2 | #include "utils.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace lunchtoast { 9 | namespace fs = std::filesystem; 10 | 11 | enum class ComparisonResult { 12 | FilesEqual, 13 | FilesDontExist, 14 | FilesNotEqual 15 | }; 16 | 17 | CompareFiles::CompareFiles(fs::path lhs, fs::path rhs, ComparisonMode mode) 18 | : lhs_{std::move(lhs)} 19 | , rhs_{std::move(rhs)} 20 | , mode_{mode} 21 | { 22 | } 23 | 24 | namespace { 25 | 26 | ComparisonResult compareFiles(const fs::path& lhs, const fs::path& rhs, ComparisonMode comparisonMode) 27 | { 28 | if (!fs::exists(lhs) || !fs::exists(rhs)) 29 | return ComparisonResult::FilesDontExist; 30 | 31 | const auto getFileContent = [&](const fs::path& path) 32 | { 33 | if (comparisonMode == ComparisonMode::Text) 34 | return readTextFile(path); 35 | return readFile(path); 36 | }; 37 | 38 | if (getFileContent(lhs) != getFileContent(rhs)) 39 | return ComparisonResult::FilesNotEqual; 40 | 41 | return ComparisonResult::FilesEqual; 42 | } 43 | 44 | std::string getFailedComparisonInfo(const ComparisonResult& result, const fs::path& lhs, const fs::path& rhs) 45 | { 46 | if (result == ComparisonResult::FilesDontExist) { 47 | if (!fs::exists(lhs)) 48 | return fmt::format("File {} doesn't exist", sfun::path_string(lhs.filename())); 49 | if (!fs::exists(rhs)) 50 | return fmt::format("File {} doesn't exist", sfun::path_string(rhs.filename())); 51 | return {}; 52 | } 53 | else if (result == ComparisonResult::FilesNotEqual) 54 | return fmt::format( 55 | "Files {} and {} aren't equal", 56 | sfun::path_string(lhs.filename()), 57 | sfun::path_string(rhs.filename())); 58 | return {}; 59 | } 60 | 61 | } //namespace 62 | 63 | TestActionResult CompareFiles::operator()() const 64 | { 65 | const auto result = compareFiles(lhs_, rhs_, mode_); 66 | if (result != ComparisonResult::FilesEqual) 67 | return TestActionResult::Failure(getFailedComparisonInfo(result, lhs_, rhs_)); 68 | return TestActionResult::Success(); 69 | } 70 | 71 | } //namespace lunchtoast 72 | -------------------------------------------------------------------------------- /src/comparefiles.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "testactionresult.h" 3 | #include 4 | #include 5 | #include 6 | 7 | namespace lunchtoast { 8 | 9 | enum class ComparisonMode { 10 | Text, 11 | Binary 12 | }; 13 | 14 | class CompareFiles { 15 | public: 16 | CompareFiles(std::filesystem::path lhs, std::filesystem::path rhs, ComparisonMode mode); 17 | TestActionResult operator()() const; 18 | 19 | private: 20 | std::filesystem::path lhs_; 21 | std::filesystem::path rhs_; 22 | ComparisonMode mode_; 23 | }; 24 | 25 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace lunchtoast { 8 | 9 | struct ExitCodeValue { 10 | std::optional value; 11 | }; 12 | 13 | } //namespace lunchtoast 14 | 15 | namespace figcone { 16 | template<> 17 | struct StringConverter { 18 | static std::optional fromString(const std::string& val) 19 | { 20 | if (val == "*" || val == "any") 21 | return lunchtoast::ExitCodeValue{}; 22 | return lunchtoast::ExitCodeValue{std::stoi(val)}; 23 | } 24 | }; 25 | } //namespace figcone 26 | 27 | namespace lunchtoast { 28 | 29 | using StringMap = std::unordered_map; 30 | 31 | struct TaggedVarsPreset : public figcone::Config { 32 | FIGCONE_PARAM(tag, std::string); 33 | FIGCONE_DICT(vars, StringMap); 34 | }; 35 | 36 | struct Action : public figcone::Config { 37 | FIGCONE_PARAM(format, std::string); 38 | FIGCONE_PARAM(command, std::string); 39 | FIGCONE_PARAM(checkExitCode, ExitCodeValue)(ExitCodeValue{0}); 40 | FIGCONE_PARAM(checkOutput, figcone::optional); 41 | FIGCONE_PARAM(checkErrorOutput, figcone::optional); 42 | FIGCONE_PARAM(stopOnFailure, bool)(true); 43 | }; 44 | 45 | struct Config : public figcone::Config { 46 | FIGCONE_DICT(vars, StringMap)(); 47 | FIGCONE_NODELIST(tagVars, std::vector)(); 48 | FIGCONE_NODELIST(actions, std::vector)(); 49 | }; 50 | 51 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/constants.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace lunchtoast::hardcoded { 5 | using namespace std::string_view_literals; 6 | 7 | inline constexpr auto appVersion = "lunchtoast v0.4.1"sv; 8 | inline constexpr auto testCaseFilename = "test.toast"sv; 9 | inline constexpr auto configFilename = "lunchtoast.cfg"sv; 10 | inline constexpr auto launchFailureReportFilename = "launch_{}.failure_info"sv; 11 | inline constexpr auto compareFileContentFailureReportFilename = "compare_file_content_{}.failure_info"sv; 12 | 13 | } //namespace lunchtoast::hardcoded -------------------------------------------------------------------------------- /src/errors.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace lunchtoast { 6 | 7 | struct TestConfigError : public std::runtime_error { 8 | explicit TestConfigError(std::string_view errorMessage) 9 | : std::runtime_error{std::string{errorMessage}} 10 | { 11 | } 12 | 13 | TestConfigError(int lineNumber, std::string_view errorMessage) 14 | : std::runtime_error{fmt::format("line {}: {}", lineNumber, errorMessage)} 15 | { 16 | } 17 | }; 18 | 19 | struct ActionFormatError : public std::runtime_error { 20 | explicit ActionFormatError(std::string_view formatString, std::string_view errorMessage) 21 | : std::runtime_error{fmt::format("Action format '{}' is invalid: {}", formatString, errorMessage)} 22 | { 23 | } 24 | }; 25 | 26 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/filenamegroup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace lunchtoast { 8 | 9 | class FilenameGroup { 10 | public: 11 | FilenameGroup(std::string filenameOrRegexp, std::filesystem::path directory); 12 | std::vector fileList() const; 13 | std::vector pathList() const; 14 | std::string string() const; 15 | 16 | private: 17 | std::string filenameOrRegexp_; 18 | std::filesystem::path directory_; 19 | std::regex fileMatchingRegexp_; 20 | bool isRegexp_; 21 | }; 22 | 23 | std::vector readFilenameGroups(const std::string& input, const std::filesystem::path& directory); 24 | 25 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/launchprocess.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "launchprocessresult.h" 3 | #include "processresultcheckmode.h" 4 | #include "testactionresult.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace lunchtoast { 14 | 15 | class TestAction; 16 | 17 | LaunchProcessResult runCommand(const std::string& cmd); 18 | 19 | class LaunchProcess { 20 | public: 21 | LaunchProcess( 22 | std::string command, 23 | std::filesystem::path workingDir, 24 | std::optional shellCommand, 25 | std::set checkModeSet, 26 | int actionIndex, 27 | sfun::optional_ref> detachedProcessList = std::nullopt, 28 | bool skipReadingOutput = false); 29 | TestActionResult operator()() const; 30 | 31 | private: 32 | std::string command_; 33 | std::filesystem::path workingDir_; 34 | std::optional shellCommand_; 35 | std::set checkModeSet_; 36 | int actionIndex_; 37 | sfun::member>> detachedProcessList_; 38 | bool skipReadingOutput_; 39 | }; 40 | 41 | } //namespace lunchtoast 42 | -------------------------------------------------------------------------------- /src/launchprocessresult.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace lunchtoast { 5 | 6 | struct LaunchProcessResult { 7 | int exitCode; 8 | std::string output; 9 | std::string errorOutput; 10 | }; 11 | 12 | } //namespace lunchtoast 13 | -------------------------------------------------------------------------------- /src/linestream.cpp: -------------------------------------------------------------------------------- 1 | #include "linestream.h" 2 | #include 3 | #include 4 | #include 5 | 6 | namespace lunchtoast { 7 | 8 | LineStream::LineStream(std::istream& stream) 9 | : stream_{stream} 10 | { 11 | } 12 | 13 | void LineStream::skipLine() 14 | { 15 | readLine(); 16 | } 17 | 18 | std::string LineStream::readLine() 19 | { 20 | auto ch = char{}; 21 | auto line = std::string{}; 22 | while (stream().get(ch)) { 23 | line += ch; 24 | if (ch == '\r') { 25 | line.pop_back(); 26 | auto pos = stream().tellg(); 27 | stream().get(ch); 28 | if (ch != '\n') 29 | stream().seekg(pos); 30 | 31 | line.push_back('\n'); 32 | lineNumber_++; 33 | return line; 34 | } 35 | if (ch == '\n') { 36 | lineNumber_++; 37 | return line; 38 | } 39 | } 40 | stream().clear(); 41 | lineNumber_++; 42 | return line; 43 | } 44 | 45 | std::string LineStream::peekLine() 46 | { 47 | auto pos = stream().tellg(); 48 | auto line = readLine(); 49 | stream().seekg(pos); 50 | lineNumber_--; 51 | return line; 52 | } 53 | 54 | bool LineStream::atEnd() 55 | { 56 | auto pos = stream().tellg(); 57 | auto ch = char{}; 58 | stream().get(ch); 59 | auto result = stream().eof(); 60 | stream().seekg(pos); 61 | return result; 62 | } 63 | 64 | int LineStream::lineNumber() const 65 | { 66 | return lineNumber_; 67 | } 68 | 69 | std::istream& LineStream::stream() 70 | { 71 | return stream_; 72 | } 73 | 74 | } //namespace lunchtoast 75 | -------------------------------------------------------------------------------- /src/linestream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace lunchtoast { 8 | 9 | class LineStream { 10 | public: 11 | explicit LineStream(std::istream& stream); 12 | void skipLine(); 13 | std::string readLine(); 14 | std::string peekLine(); 15 | bool atEnd(); 16 | int lineNumber() const; 17 | 18 | private: 19 | std::istream& stream(); 20 | 21 | private: 22 | sfun::member stream_; 23 | int lineNumber_ = 1; 24 | }; 25 | 26 | } //namespace lunchtoast 27 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "commandline.h" 2 | #include "config.h" 3 | #include "constants.h" 4 | #include "test.h" 5 | #include "testcontentsgenerator.h" 6 | #include "testlauncher.h" 7 | #include "testreporter.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace lunchtoast; 15 | namespace fs = std::filesystem; 16 | 17 | int generateTestContents(const CommandSaveContents& commandCfg); 18 | Config readConfig(const CommandLine& commandLine); 19 | 20 | int mainApp(const CommandLine& commandLine) 21 | { 22 | if (commandLine.saveContents.has_value()) 23 | return generateTestContents(commandLine.saveContents.value()); 24 | 25 | const auto cfg = readConfig(commandLine); 26 | try { 27 | const auto testReporter = TestReporter{commandLine.reportFile, commandLine.reportWidth}; 28 | auto testLauncher = TestLauncher{testReporter, commandLine, cfg}; 29 | const auto allTestPassed = testLauncher.process(); 30 | return allTestPassed ? 0 : 1; 31 | } 32 | catch (const std::runtime_error& e) { 33 | fmt::print(fmt::runtime(e.what())); 34 | return 2; 35 | } 36 | catch (const std::exception& e) { 37 | fmt::print("Unknown error occurred during test processing: {}\n", e.what()); 38 | return 2; 39 | } 40 | } 41 | 42 | #ifdef _WIN32 43 | int wmain(int argc, wchar_t** argv) 44 | { 45 | auto cmdlineReader = 46 | cmdlime::CommandLineReader{"lunchtoast", std::string{hardcoded::appVersion}}; 47 | cmdlineReader.setErrorOutputStream(std::cout); 48 | return cmdlineReader.exec(argc, argv, mainApp); 49 | } 50 | #else 51 | int main(int argc, char** argv) 52 | { 53 | auto cmdlineReader = 54 | cmdlime::CommandLineReader{"lunchtoast", std::string{hardcoded::appVersion}}; 55 | cmdlineReader.setErrorOutputStream(std::cout); 56 | return cmdlineReader.exec(argc, argv, mainApp); 57 | } 58 | #endif 59 | 60 | int generateTestContents(const CommandSaveContents& commandCfg) 61 | { 62 | try { 63 | if (saveTestContents(commandCfg.testPath)) 64 | return 0; 65 | else 66 | return 1; 67 | } 68 | catch (const std::exception& e) { 69 | fmt::print("Unknown error occurred during creation of test cleanup whitelist: {}\n", e.what()); 70 | return 2; 71 | } 72 | } 73 | 74 | Config readConfig(const CommandLine& commandLine) 75 | { 76 | if (!commandLine.config.empty()) { 77 | auto cfgReader = figcone::ConfigReader{}; 78 | return cfgReader.readShoalFile(commandLine.config); 79 | } 80 | return Config{}; 81 | } -------------------------------------------------------------------------------- /src/processresultcheckmode.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | namespace lunchtoast { 7 | 8 | struct ProcessResultCheckMode { 9 | struct ExitCode { 10 | std::optional value; 11 | }; 12 | struct Output { 13 | std::string value; 14 | }; 15 | struct ErrorOutput { 16 | std::string value; 17 | }; 18 | 19 | template, ProcessResultCheckMode>>* = nullptr> 20 | explicit ProcessResultCheckMode(T&& mode) 21 | : value{std::forward(mode)} 22 | { 23 | } 24 | 25 | bool operator<(const ProcessResultCheckMode& rhs) const 26 | { 27 | return value.index() < rhs.value.index(); 28 | } 29 | 30 | std::variant value; 31 | }; 32 | 33 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/section.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace lunchtoast { 6 | 7 | struct Section { 8 | std::string name; 9 | std::string value; 10 | std::string originalText; 11 | }; 12 | 13 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/sectionsreader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "errors.h" 3 | #include "section.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace lunchtoast { 10 | 11 | class SectionReadingError { 12 | public: 13 | operator bool() 14 | { 15 | return error_.has_value(); 16 | } 17 | 18 | TestConfigError value() 19 | { 20 | return error_.value(); 21 | } 22 | 23 | void operator=(const TestConfigError& error) 24 | { 25 | error_ = error; 26 | } 27 | 28 | private: 29 | std::optional error_; 30 | }; 31 | 32 | std::vector
readSections(std::istream& input); 33 | std::vector
readSections(std::istream& input, SectionReadingError&); 34 | 35 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/test.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "filenamegroup.h" 3 | #include "launchprocessresult.h" 4 | #include "section.h" 5 | #include "testaction.h" 6 | #include "testresult.h" 7 | #include "useraction.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace lunchtoast { 18 | 19 | class Test { 20 | public: 21 | explicit Test( 22 | const std::filesystem::path& testCasePath, 23 | const std::unordered_map& vars, 24 | std::vector userActions, 25 | std::string shellCommand, 26 | bool cleanup); 27 | TestResult process(); 28 | 29 | const std::string& suite() const; 30 | const std::string& name() const; 31 | const std::string& description() const; 32 | 33 | private: 34 | void readTestCase(const std::filesystem::path& path, const std::unordered_map& vars); 35 | std::vector
readParam(const std::vector
& sections); 36 | std::vector
readAction( 37 | const std::vector
& sections, 38 | const std::unordered_map& vars); 39 | std::vector
createLaunchAction(const Section& section, const std::vector
& nextSections); 40 | void createWriteAction(const Section& section); 41 | void createCompareFilesAction( 42 | TestActionType actionType, 43 | const std::string& comparisonType, 44 | const std::string& filenamesStr); 45 | void createCompareFileContentAction( 46 | TestActionType actionType, 47 | const std::string& filenameStr, 48 | const std::string& expectedFileContent); 49 | void createComparisonAction( 50 | TestActionType actionType, 51 | const std::string& encodedActionType, 52 | const Section& section); 53 | void cleanTestFiles(); 54 | bool readParam(std::string& param, const std::string& paramName, const Section& section); 55 | bool readParam(std::filesystem::path& param, const std::string& paramName, const Section& section); 56 | bool readParam(std::vector& param, const std::string& paramName, const Section& section); 57 | bool readParam(bool& param, const std::string& paramName, const Section& section); 58 | void postProcessCleanupConfig(const std::filesystem::path& testCasePath); 59 | void checkParams(); 60 | 61 | private: 62 | std::vector actions_; 63 | sfun::member> userActions_; 64 | sfun::member shellCommand_; 65 | sfun::member cleanup_; 66 | std::filesystem::path directory_; 67 | std::string name_; 68 | std::string description_; 69 | std::string suite_; 70 | bool isEnabled_ = true; 71 | std::vector contents_; 72 | std::optional launchActionResult_; 73 | std::vector detachedProcessList_; 74 | }; 75 | 76 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/testaction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "comparefilecontent.h" 3 | #include "comparefiles.h" 4 | #include "launchprocess.h" 5 | #include "testactiontype.h" 6 | #include "wait.h" 7 | #include "writefile.h" 8 | #include 9 | 10 | namespace lunchtoast { 11 | 12 | class TestAction { 13 | public: 14 | template 15 | TestAction(TAction action, TestActionType actionType) 16 | : action_{std::move(action)} 17 | , actionType_{actionType} 18 | { 19 | } 20 | 21 | template 22 | void process(TFuncOnSuccess onSuccess, TFuncOnFailure onFailure, TFuncOnRuntimeError onRuntimeError) const 23 | { 24 | auto processAction = [&](auto& action) 25 | { 26 | try { 27 | auto result = action(); 28 | if (result.isSuccessful()) 29 | onSuccess(action); 30 | else 31 | onFailure(action, result.errorInfo()); 32 | } 33 | catch (const std::exception& e) { 34 | onRuntimeError(action, e.what()); 35 | } 36 | }; 37 | std::visit(processAction, action_); 38 | } 39 | 40 | template 41 | bool is() const 42 | { 43 | return std::holds_alternative(action_); 44 | } 45 | 46 | TestActionType type() const 47 | { 48 | return actionType_; 49 | } 50 | 51 | private: 52 | std::variant action_; 53 | TestActionType actionType_; 54 | }; 55 | 56 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/testactionresult.cpp: -------------------------------------------------------------------------------- 1 | #include "testactionresult.h" 2 | 3 | namespace lunchtoast { 4 | 5 | TestActionResult TestActionResult::Success() 6 | { 7 | auto result = TestActionResult{}; 8 | result.isSuccessful_ = true; 9 | return result; 10 | } 11 | 12 | TestActionResult TestActionResult::Failure(const std::string& errorInfo) 13 | { 14 | auto result = TestActionResult{}; 15 | result.isSuccessful_ = false; 16 | result.errorInfo_ = errorInfo; 17 | return result; 18 | } 19 | 20 | bool TestActionResult::isSuccessful() const 21 | { 22 | return isSuccessful_; 23 | } 24 | 25 | const std::string& TestActionResult::errorInfo() const 26 | { 27 | return errorInfo_; 28 | } 29 | 30 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/testactionresult.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace lunchtoast { 5 | 6 | class TestActionResult { 7 | public: 8 | static TestActionResult Success(); 9 | static TestActionResult Failure(const std::string& errorInfo); 10 | 11 | bool isSuccessful() const; 12 | const std::string& errorInfo() const; 13 | 14 | private: 15 | TestActionResult() = default; 16 | 17 | private: 18 | bool isSuccessful_ = false; 19 | std::string errorInfo_; 20 | }; 21 | 22 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/testactiontype.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace lunchtoast { 4 | 5 | enum class TestActionType { 6 | RequiredOperation, 7 | Expectation, 8 | Assertion 9 | }; 10 | 11 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/testcontentsgenerator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | namespace lunchtoast { 7 | 8 | bool saveTestContents(const std::filesystem::path& testPath); 9 | 10 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/testlauncher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "testsuite.h" 3 | #include "useraction.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace lunchtoast { 12 | 13 | class Test; 14 | class TestResult; 15 | class TestReporter; 16 | struct CommandLine; 17 | struct Config; 18 | 19 | class TestLauncher { 20 | public: 21 | TestLauncher(const TestReporter&, const CommandLine&, const Config&); 22 | bool process(); 23 | 24 | private: 25 | void collectTests( 26 | const std::filesystem::path& testPath, 27 | std::vector configList, 28 | std::optional searchDirectoryLevels); 29 | void addTest(const std::filesystem::path& testFile, const std::vector& configList); 30 | std::vector processSuite(const std::string& suiteName, TestSuite& suite); 31 | const TestReporter& reporter() const; 32 | 33 | private: 34 | TestSuite defaultSuite_; 35 | std::map suites_; 36 | sfun::member reporter_; 37 | sfun::member config_; 38 | sfun::member> userActions_; 39 | sfun::member shellCommand_; 40 | sfun::member cleanup_; 41 | sfun::member> selectedTags_; 42 | sfun::member> skippedTags_; 43 | sfun::member listOfFailedTests_; 44 | sfun::member dirWithFailedTests_; 45 | }; 46 | 47 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/testreporter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "testsuite.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace lunchtoast { 9 | 10 | class Test; 11 | class TestResult; 12 | 13 | class TestReporter { 14 | public: 15 | TestReporter(const std::filesystem::path& reportFilePath, int reportWidth); 16 | void reportResult( 17 | const Test& test, 18 | const TestResult& result, 19 | std::string suiteName, 20 | int suiteTestNumber, 21 | sfun::ssize_t suiteNumOfTests) const; 22 | void reportBrokenTest( 23 | const std::filesystem::path& brokenTestConfig, 24 | const std::string& errorInfo, 25 | std::string suiteName, 26 | int suiteTestNumber, 27 | sfun::ssize_t suiteNumOfTests) const; 28 | void reportDisabledTest( // 29 | const Test& test, 30 | std::string suiteName, 31 | int suiteTestNumber, 32 | sfun::ssize_t suiteNumOfTests) const; 33 | void reportSummary(const TestSuite& defaultSuite, const std::map& suites) const; 34 | 35 | private: 36 | int reportWidth_; 37 | }; 38 | 39 | } //namespace lunchtoast 40 | -------------------------------------------------------------------------------- /src/testresult.cpp: -------------------------------------------------------------------------------- 1 | #include "testresult.h" 2 | 3 | namespace lunchtoast { 4 | 5 | TestResult TestResult::Success() 6 | { 7 | auto result = TestResult{}; 8 | result.type_ = TestResultType::Success; 9 | return result; 10 | } 11 | 12 | TestResult TestResult::Failure(const std::vector& failedActionsMessages) 13 | { 14 | auto result = TestResult{}; 15 | result.type_ = TestResultType::Failure; 16 | result.failedActionsMessages_ = failedActionsMessages; 17 | return result; 18 | } 19 | 20 | TestResult TestResult::RuntimeError(const std::string& errorMsg, const std::vector& failedActionsMessages) 21 | { 22 | auto result = TestResult{}; 23 | result.errorInfo_ = errorMsg; 24 | result.type_ = TestResultType::RuntimeError; 25 | result.failedActionsMessages_ = failedActionsMessages; 26 | return result; 27 | } 28 | 29 | TestResultType TestResult::type() const 30 | { 31 | return type_; 32 | } 33 | 34 | const std::string& TestResult::errorInfo() const 35 | { 36 | return errorInfo_; 37 | } 38 | 39 | const std::vector& TestResult::failedActionsMessages() const 40 | { 41 | return failedActionsMessages_; 42 | } 43 | 44 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/testresult.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace lunchtoast { 6 | 7 | enum class TestResultType { 8 | Success, 9 | Failure, 10 | RuntimeError 11 | }; 12 | 13 | class TestResult { 14 | public: 15 | static TestResult Success(); 16 | static TestResult Failure(const std::vector& failedActionsMessages); 17 | static TestResult RuntimeError(const std::string& errorMsg, const std::vector& failedActionsMessages); 18 | 19 | TestResultType type() const; 20 | const std::string& errorInfo() const; 21 | const std::vector& failedActionsMessages() const; 22 | 23 | private: 24 | TestResult() = default; 25 | 26 | private: 27 | TestResultType type_ = TestResultType::Failure; 28 | std::string errorInfo_; 29 | std::vector failedActionsMessages_; 30 | }; 31 | 32 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/testsuite.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "useraction.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace lunchtoast { 10 | 11 | struct TestCfg { 12 | std::filesystem::path path; 13 | bool isEnabled; 14 | std::unordered_map vars; 15 | std::vector userActions; 16 | }; 17 | 18 | struct TestSuite { 19 | std::vector tests; 20 | int passedTestsCounter = 0; 21 | int disabledTestsCounter = 0; 22 | }; 23 | 24 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/useraction.cpp: -------------------------------------------------------------------------------- 1 | #include "useraction.h" 2 | #include "useractionformatparser.h" 3 | #include "utils.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace lunchtoast { 12 | namespace views = ranges::views; 13 | 14 | UserAction::UserAction(const Action& action) 15 | : commandFormat_{action.command} 16 | , actionType_{action.stopOnFailure ? TestActionType::Assertion : TestActionType::Expectation} 17 | { 18 | auto [formatRegexStr, paramsOrder] = makeUserActionFormat(action.format); 19 | format_ = std::regex{formatRegexStr}; 20 | paramsOrder_ = std::move(paramsOrder); 21 | if (action.checkExitCode.value.has_value()) 22 | processResultCheckModeSet_.emplace(ProcessResultCheckMode::ExitCode{action.checkExitCode.value}); 23 | if (action.checkOutput.has_value()) 24 | processResultCheckModeSet_.emplace(ProcessResultCheckMode::Output{action.checkOutput.value()}); 25 | if (action.checkErrorOutput.has_value()) 26 | processResultCheckModeSet_.emplace(ProcessResultCheckMode::ErrorOutput{action.checkErrorOutput.value()}); 27 | } 28 | 29 | std::optional UserAction::makeCommand( 30 | const std::string& action, 31 | const std::unordered_map& vars, 32 | const std::string& inputParam) const 33 | { 34 | auto match = std::smatch{}; 35 | if (!std::regex_search(action, match, format_)) 36 | return std::nullopt; 37 | if (!match.prefix().str().empty() || !match.suffix().str().empty()) 38 | return std::nullopt; 39 | 40 | auto command = commandFormat_; 41 | for (auto i = 0; i < std::ssize(match) - 1; ++i) 42 | command = sfun::replace(command, fmt::format("%{}", paramsOrder_.at(i)), match[i + 1].str()); 43 | 44 | for (const auto& [name, value] : readInputParamSections(inputParam)) 45 | command = sfun::replace(command, fmt::format("%input.{}", name), value); 46 | command = sfun::replace(command, "%input", inputParam); 47 | 48 | command = processVariablesSubstitution(command, vars); 49 | return command; 50 | } 51 | 52 | std::set UserAction::makeProcessResultCheckModeSet( 53 | const std::unordered_map& vars, 54 | const std::string& inputParam) const 55 | { 56 | const auto checkModeVisitor = sfun::overloaded{ 57 | [](ProcessResultCheckMode::ExitCode&) {}, 58 | [&](auto& checkMode) 59 | { 60 | for (const auto& [name, value] : readInputParamSections(inputParam)) 61 | checkMode.value = sfun::replace(checkMode.value, fmt::format("%input.{}", name), value); 62 | checkMode.value = sfun::replace(checkMode.value, "%input", inputParam); 63 | checkMode.value = processVariablesSubstitution(checkMode.value, vars); 64 | }}; 65 | const auto processCheckMode = [&](ProcessResultCheckMode checkMode) 66 | { 67 | std::visit(checkModeVisitor, checkMode.value); 68 | return checkMode; 69 | }; 70 | return processResultCheckModeSet_ | views::transform(processCheckMode) | ranges::to; 71 | } 72 | 73 | TestActionType UserAction::actionType() const 74 | { 75 | return actionType_; 76 | } 77 | 78 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/useraction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "config.h" 3 | #include "processresultcheckmode.h" 4 | #include "testactiontype.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace lunchtoast { 13 | 14 | class UserAction { 15 | public: 16 | UserAction(const Action& action); 17 | std::optional makeCommand( 18 | const std::string& action, 19 | const std::unordered_map& vars, 20 | const std::string& inputParam) const; 21 | std::set makeProcessResultCheckModeSet( 22 | const std::unordered_map& vars, 23 | const std::string& inputParam) const; 24 | TestActionType actionType() const; 25 | 26 | private: 27 | std::regex format_; 28 | std::string commandFormat_; 29 | std::vector paramsOrder_; 30 | std::set processResultCheckModeSet_; 31 | TestActionType actionType_; 32 | }; 33 | 34 | } //namespace lunchtoast 35 | -------------------------------------------------------------------------------- /src/useractionformatparser.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | namespace lunchtoast { 7 | 8 | struct UserActionFormat { 9 | std::string formatRegex; 10 | std::vector paramsOrder; 11 | }; 12 | UserActionFormat makeUserActionFormat(const std::string& format); 13 | 14 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace lunchtoast { 14 | 15 | std::string readTextFile(const std::filesystem::path& filePath); 16 | std::string readFile(const std::filesystem::path& filePath); 17 | std::vector readFilenames(const std::string& input, const std::filesystem::path& directory); 18 | std::string processVariablesSubstitution(std::string value, const std::unordered_map& vars); 19 | std::vector getDirectoryContent(const std::filesystem::path& dir); 20 | std::string homePathString(const std::filesystem::path& path); 21 | std::string toLower(std::string_view str); 22 | std::vector splitCommand(const std::string& str); 23 | std::vector splitSectionValue(const std::string& str); 24 | std::unordered_map readInputParamSections(const std::string&); 25 | std::string normalizeLineEndings(std::string_view str); 26 | std::optional readTime(std::string_view str); 27 | 28 | 29 | template 30 | requires requires(TContainer t) { 31 | { 32 | std::begin(t) 33 | } -> std::same_as; 34 | { 35 | std::end(t) 36 | } -> std::same_as; 37 | } 38 | bool contains(const TContainer& range, const TContainer& subrange) 39 | { 40 | return std::search(std::begin(range), std::end(range), std::begin(subrange), std::end(subrange)) != std::end(range); 41 | } 42 | 43 | class StringStream { 44 | public: 45 | explicit StringStream(const std::string& str); 46 | void skip(); 47 | std::optional read(); 48 | std::optional peek(); 49 | bool atEnd(); 50 | std::string readUntil(std::function pred); 51 | std::string readUntil(std::function pred, bool& stoppedAtEnd); 52 | 53 | private: 54 | std::stringstream stream_; 55 | }; 56 | 57 | } //namespace lunchtoast 58 | -------------------------------------------------------------------------------- /src/wait.cpp: -------------------------------------------------------------------------------- 1 | #include "wait.h" 2 | #include "errors.h" 3 | #include "utils.h" 4 | #include 5 | 6 | namespace lunchtoast { 7 | 8 | Wait::Wait(std::chrono::milliseconds timePeriod) 9 | : timePeriod_{timePeriod} 10 | { 11 | } 12 | 13 | TestActionResult Wait::operator()() const 14 | { 15 | std::this_thread::sleep_for(timePeriod_); 16 | return TestActionResult::Success(); 17 | } 18 | 19 | Wait makeWaitAction(const Section& section) 20 | { 21 | auto time = readTime(section.value); 22 | if (!time.has_value()) 23 | throw TestConfigError{"Wait section value must specify time duration (e.g. '500 ms')"}; 24 | 25 | return Wait{time.value()}; 26 | } 27 | 28 | }//namespace lunchtoast -------------------------------------------------------------------------------- /src/wait.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "testactionresult.h" 3 | #include "section.h" 4 | #include 5 | #include 6 | #include 7 | 8 | namespace lunchtoast { 9 | 10 | class Wait { 11 | public: 12 | explicit Wait(std::chrono::milliseconds timePeriod); 13 | TestActionResult operator()() const; 14 | 15 | private: 16 | std::chrono::milliseconds timePeriod_; 17 | }; 18 | 19 | Wait makeWaitAction(const Section&); 20 | 21 | } //namespace lunchtoast 22 | -------------------------------------------------------------------------------- /src/writefile.cpp: -------------------------------------------------------------------------------- 1 | #include "writefile.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace lunchtoast { 9 | namespace fs = std::filesystem; 10 | 11 | WriteFile::WriteFile(fs::path filePath, std::string content) 12 | : filePath_(std::move(filePath)) 13 | , content_(std::move(content)) 14 | { 15 | } 16 | 17 | TestActionResult WriteFile::operator()() const 18 | { 19 | auto fileStream = std::ofstream(filePath_, std::ios::binary); 20 | fileStream.exceptions(std::ifstream::failbit | std::ifstream::badbit); 21 | try { 22 | fileStream.write(content_.c_str(), std::ssize(content_)); 23 | } 24 | catch (std::exception& e) { 25 | return TestActionResult::Failure( 26 | fmt::format("File {} writing error: {}", sfun::path_string(filePath_), e.what())); 27 | } 28 | return TestActionResult::Success(); 29 | } 30 | 31 | } //namespace lunchtoast -------------------------------------------------------------------------------- /src/writefile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "testactionresult.h" 3 | #include 4 | #include 5 | 6 | namespace lunchtoast { 7 | 8 | class WriteFile { 9 | public: 10 | WriteFile(std::filesystem::path fileName, std::string content); 11 | TestActionResult operator()() const; 12 | 13 | private: 14 | std::filesystem::path filePath_; 15 | std::string content_; 16 | }; 17 | 18 | } //namespace lunchtoast 19 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18) 2 | project(test_lunchtoast) 3 | 4 | set(SRC 5 | test_sectionsreader.cpp 6 | test_utils.cpp 7 | test_useractionformatparser.cpp 8 | ../src/useractionformatparser.cpp 9 | ../src/sectionsreader.cpp 10 | ../src/linestream.cpp 11 | ../src/utils.cpp 12 | ) 13 | 14 | SealLake_GoogleTest( 15 | NAME test_lunchtoast 16 | SOURCES ${SRC} 17 | COMPILE_FEATURES cxx_std_20 18 | PROPERTIES 19 | CXX_EXTENSIONS OFF 20 | INCLUDES 21 | ../src 22 | ${SEAL_LAKE_SOURCE_range-v3}/include 23 | LIBRARIES 24 | sfun::sfun fmt::fmt Microsoft.GSL::GSL sago::platform_folders 25 | ) 26 | -------------------------------------------------------------------------------- /tests/assert_exception.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | template 6 | void assert_exception( 7 | std::function throwingCode, 8 | std::function exceptionContentChecker) 9 | { 10 | try { 11 | throwingCode(); 12 | FAIL() << "exception wasn't thrown!"; 13 | } 14 | catch (const ExceptionType& e) { 15 | exceptionContentChecker(e); 16 | } 17 | catch (...) { 18 | FAIL() << "Unexpected exception was thrown"; 19 | } 20 | } -------------------------------------------------------------------------------- /tests/test_useractionformatparser.cpp: -------------------------------------------------------------------------------- 1 | #include "assert_exception.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace lunchtoast; 7 | 8 | TEST(UserActionFormatParser, SingleParam) 9 | { 10 | auto userActionFormat = makeUserActionFormat("%1"); 11 | EXPECT_EQ(userActionFormat.formatRegex, R"((.+))"); 12 | EXPECT_EQ(userActionFormat.paramsOrder, std::vector{1}); 13 | } 14 | 15 | TEST(UserActionFormatParser, SingleParam2) 16 | { 17 | auto userActionFormat = makeUserActionFormat("Hello world %1"); 18 | EXPECT_EQ(userActionFormat.formatRegex, R"(Hello world\s+(.+))"); 19 | EXPECT_EQ(userActionFormat.paramsOrder, std::vector{1}); 20 | } 21 | 22 | TEST(UserActionFormatParser, SingleParam3) 23 | { 24 | auto userActionFormat = makeUserActionFormat("%1 Hello world"); 25 | EXPECT_EQ(userActionFormat.formatRegex, R"((.+?)\s+Hello world)"); 26 | EXPECT_EQ(userActionFormat.paramsOrder, std::vector{1}); 27 | } 28 | 29 | TEST(UserActionFormatParser, SingleParam4) 30 | { 31 | auto userActionFormat = makeUserActionFormat("Hello%1world"); 32 | EXPECT_EQ(userActionFormat.formatRegex, R"(Hello(.+?)world)"); 33 | EXPECT_EQ(userActionFormat.paramsOrder, std::vector{1}); 34 | } 35 | 36 | TEST(UserActionFormatParser, MultipleParams) 37 | { 38 | auto userActionFormat = makeUserActionFormat("%3 %1 %2"); 39 | EXPECT_EQ(userActionFormat.formatRegex, R"((.+?)\s+(.+?)\s+(.+))"); 40 | EXPECT_EQ(userActionFormat.paramsOrder, (std::vector{3, 1, 2})); 41 | } 42 | 43 | TEST(UserActionFormatParser, MultipleParams2) 44 | { 45 | auto userActionFormat = makeUserActionFormat("%3 Hello %1 world %2"); 46 | EXPECT_EQ(userActionFormat.formatRegex, R"((.+?)\s+Hello\s+(.+?)\s+world\s+(.+))"); 47 | EXPECT_EQ(userActionFormat.paramsOrder, (std::vector{3, 1, 2})); 48 | } 49 | 50 | TEST(UserActionFormatParser, MultipleParams3) 51 | { 52 | auto userActionFormat = makeUserActionFormat("%3Hello%1 world %2"); 53 | EXPECT_EQ(userActionFormat.formatRegex, R"((.+?)Hello(.+?)\s+world\s+(.+))"); 54 | EXPECT_EQ(userActionFormat.paramsOrder, (std::vector{3, 1, 2})); 55 | } 56 | 57 | TEST(UserActionFormatParser, ErrorSameParameters) 58 | { 59 | assert_exception( 60 | [] 61 | { 62 | makeUserActionFormat("%3Hello%1 world %1"); 63 | }, 64 | [](const auto& e) 65 | { 66 | ASSERT_EQ( 67 | std::string{e.what()}, 68 | "Action format '%3Hello%1 world %1' is invalid: encountered multiple parameters %1, format " 69 | "parameters indices must be unique"); 70 | }); 71 | } 72 | 73 | TEST(UserActionFormatParser, ErrorMissingParameters) 74 | { 75 | assert_exception( 76 | [] 77 | { 78 | makeUserActionFormat("%3Hello%4 world %1"); 79 | }, 80 | [](const auto& e) 81 | { 82 | ASSERT_EQ( 83 | std::string{e.what()}, 84 | "Action format '%3Hello%4 world %1' is invalid: format parameters indices must form a " 85 | "continuous range starting with 1"); 86 | }); 87 | } 88 | 89 | TEST(UserActionFormatParser, ErrorMissingParameters2) 90 | { 91 | assert_exception( 92 | [] 93 | { 94 | makeUserActionFormat("%2Hello%3 world %4"); 95 | }, 96 | [](const auto& e) 97 | { 98 | ASSERT_EQ( 99 | std::string{e.what()}, 100 | "Action format '%2Hello%3 world %4' is invalid: format parameters indices must form a " 101 | "continuous range starting with 1"); 102 | }); 103 | } -------------------------------------------------------------------------------- /vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lunchtoast", 3 | "version-string": "0.1.0", 4 | "dependencies": [ 5 | "boost-process" 6 | ] 7 | } 8 | --------------------------------------------------------------------------------