approvals / approvals/ApprovalTests.cpp
"Unable to create directory" - unable to run test build with mingw provided by qt-installer
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 339
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I want to use approval test for some legacy embedded C code.
Thus my c++/cmake knowledge is very limited.
My Setup:
- Windows 10
- ApprovalTests 10.12.2
- CMake 3.21.1 -- provided by qt-installer
- MinGw64 11.2.0 -- provided by qt-installer for qt 6.3.0
- QT Creator 7.0.1
I get the same error message as mentioned in #195
I took his example files and created a new cmake project via QT Creator
__FILE__ == C:/Users/florian.fischer/Documents/inmach/src/approvalTest_problem/path_problem_demo/test.cpp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
path_problem_demo.exe is a Catch v2.13.9 host application.
Run with -? for options
-------------------------------------------------------------------------------
MyTestCase
-------------------------------------------------------------------------------
C:/Users/florian.fischer/Documents/inmach/src/approvalTest_problem/path_problem_demo/test.cpp:5
...............................................................................
C:/Users/florian.fischer/Documents/inmach/src/approvalTest_problem/path_problem_demo/test.cpp:5: FAILED:
due to unexpected exception with message:
Unable to create directory:
===============================================================================
test cases: 1 | 1 failed
assertions: 1 | 1 failed
I "solved" it by modifying
std::string SystemUtils::getDirectorySeparator()
{
//return isWindowsOs() ? "\\" : "/";
return "/";
}
But then it fails when i want to use AutoApproveIfMissingReporter because copy does not like the paths with / instead of \
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the example in test.cpp and reproduce the failure using the listed Qt Creator, CMake, and MinGW setup on Windows. Inspect SystemUtils::getDirectorySeparator() and the path handling used by AutoApproveIfMissingReporter, then verify that directory creation and approval-file copying both work without changing the separator behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100