Comments (8)
Thanks for letting me know about this - I'll have a go at reproducing it..
Any extra info that you could provide about how your build was set up would be really helpful...
We already have code for something like this with (I think) Mingw and Cygwin builds, which all vary in how they handle file paths and launching processes.
So before taking on another dependency, it would be worth looking at whether the fixes we have for those platforms can be generalised in any way to cover clang on Windows as well.
I think this also means it's time to set up a Windows/Clang CI build too...
from approvaltests.cpp.
My build was set-up using visual studio with the clang_cl_x64 environment. I used the source_location functionality (__builtin_FILE()) and the path provided was in unix style. ApprovalTests then creates a file with a name like this (on the binary's folder):
C__Folder_main.test0.approved
The patch is easy to make. This:
static std::string getDirectorySeparator()
{
return isWindowsOs() ? "\\" : "/";
}
can become this:
```cpp
static std::string getDirectorySeparator()
{
#if defined(__clang__)
return "/";
#else
return isWindowsOs() ? "\\" : "/";
#endif
}
But I've seen cases were paths come with \ and / (past experience - don't have a code example now). To account for this, a more robust solution would be required to be implemented and tested against these types of weird scenarios, that differ depending on OS and compiler. That reason why I recommended the Filesystem lib. It's well tested (96% coverage), source compatible with std::filesystem (which enable for a smooth transition on the future), handles UTF-8 and would allow for removal of code from Approval Tests (less is better :) ).
Another option would be to create a filesystem header with just the functions Approval Tests needs. Seems it only needs exists, path, stem and extension functions, which can make for a small header.
What do you think?
from approvaltests.cpp.
I've tried reproducing this with the following:
- Update to latest Visual Studio 2019
- Install "C++ Clang tools for Windows (9.0.0 - x64/x86)
- Launch Visual Studio
- File > Open > Open Folder
- Select my clone of Approval Tests.cpp and open it
- Select "Manage Configurations" (from a drop-down in a toolbar)
- Click the green "+"
- Add "x64-Claren-Release"
- Save the CMakeSettings.json file
- Set the Startup Program to be DocTest_Tests.exe
- Run
I then get output beginning with this:
[doctest] doctest version is "2.3.5"
[doctest] run with "--help" for options
===============================================================================
..\..\..\tests\DocTest_Tests\ApprovalTestTests.cpp(7):
TEST CASE: YouCanUseAWriter
..\..\..\tests\DocTest_Tests\ApprovalTestTests.cpp(7): ERROR: test case THREW exception: Unable to create directory: ..\..\..\tests\DocTest_Tests\approval_tests\
===============================================================================
..\..\..\tests\DocTest_Tests\ApprovalTestTests.cpp(16):
TEST CASE: YouCanSpecifyYourFileExtension
..\..\..\tests\DocTest_Tests\ApprovalTestTests.cpp(16): ERROR: test case THREW exception: Unable to create directory: ..\..\..\tests\DocTest_Tests\approval_tests\
This looks like it may be the same problem as is logged in #55
from approvaltests.cpp.
Hi @lp55
I don't think I've managed to reproduce this - when you have time, please could you give me the steps to reproduce it?
Looking at #29 it does seem that someone has previously been able to use this project with clang-cl - so I'm wondering what's different either with Visual Studio these days, or perhaps your set up now?
Googling also didn't leave me confident in what installer exactly to use for clang_cl_x64...
from approvaltests.cpp.
from approvaltests.cpp.
from approvaltests.cpp.
We added a help message in the v.7.0.0 release that points to this page - so hopefully if people see this problem, it will be easier to diagnose.
Leaving this open, as the issue itself has not been addressed.
from approvaltests.cpp.
Closing, as this is more than a year old, there have been no further reports, and we do have CI running the tests in Visual
Studio with clang.
So this is very likely to be correct.
from approvaltests.cpp.
Related Issues (20)
- Add clang12 CI build HOT 1
- Provide a script to allow users to generate the single header from the current code, without doing a release HOT 9
- Add a documentation example showing how to obtain ApprovalTests.cpp via CPM.cmake HOT 1
- Add vcpkg to our release process HOT 2
- Document how to use Approval Tests with vcpkg HOT 1
- Bullet lists not rendered correcting on Read the Docs version of our documentation HOT 3
- Add a copyright statement to the released single header HOT 1
- GitHub Actions: Don't run scheduled tasks on forked repos
- Using kdiff3 as diff tool, user has to specify name of output file after merge
- cygwin CI build hangs for 6 hours then fails HOT 5
- warning C4459 in MSVC with /W4 HOT 1
- Does not compile with clang13 due to -Werror/-Wdeprecated-copy-with-dtor HOT 2
- Ninja + Catch2 + mingw64
- useApprovalsSubdirectory() doesn't create the output directory in the expected location HOT 3
- "Unable to create directory" - unable to run test build with mingw provided by qt-installer HOT 5
- with CppUTest: `ApprovalMismatchException` suppresses other tests output HOT 4
- add `code -d {Received} {Approved}` to Reporters list
- Catch2 integration does not handle Generators inside sections HOT 1
- Catch2 v3 integration HOT 5
- Bug with {fmt} integration HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from approvaltests.cpp.