-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor tests for invalid format items #474
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## latest #474 +/- ##
==========================================
- Coverage 90.42% 90.17% -0.25%
==========================================
Files 47 47
Lines 4385 4388 +3
Branches 587 588 +1
==========================================
- Hits 3965 3957 -8
- Misses 286 288 +2
- Partials 134 143 +9 ☔ View full report in Codecov by Sentry. |
a few changes that I forgot earlier:
|
@goatshriek, could you surmise why tests fail? |
I can't identify the exact cause from a quick glance. Are you seeing failures when you run the tests yourself? There may be entries in the directory walk that you aren't expecting, based on some of the error messages being an "unknown file". Perhaps that would be the best place to start troubleshooting. |
no, unfortunately, I have no errors on my Mac. I will add line terminators to the files that I added in directory |
ok, found it - dirent.h include is not available for Windows, I need to add code for Win additionally. |
I made code Win and Unix/Linux/MacOS compatible and CLang pure (without C++ elements). |
Joel, some Windows tests are failing due to attempt to load 'dirent.h'. D:\a\stumpless\stumpless\test\helper\fixture.cpp(20,12): fatal error C1083: Cannot open include file: 'dirent.h': No such file or directory [D:\a\stumpless\stumpless\test_helper_fixture.vcxproj] However, I have the following code:
Can it be a case where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, thanks very much for putting together this change!
The HAVE_WINDOWS_H
symbol is defined in the private configuration header, which is not exposed in the tests. This is why it is still being included in your tests, despite it being defined during the build itself. The header check in the Static Analysis would warn you about this.
Taking a step back though, it seems that filesystem operations in C++ can be hard to make portable, which isn't something I had anticipated.
Currently, the project does not impose any C++ version restrictions, instead simply inheriting from Google Test, which currently requires C++11. Newer versions of C++ (from C++17 onwards) have <filesystem>
, which seems like it will make this much easier for you given this Stack Overflow example.
Fortunately we're working on a major version release right now, so a major change like this is acceptable. Furthermore, I intend to migrate to Google FuzzTest as part of #335. FuzzTest requires C++17 anyway, so this standard will be in bounds for the C++ version required for testing. You may need to add a C++ standard statement to CMake for now to get things to build. If so you can add this anywhere, and I will refactor it when I update CMake and integrate FuzzTest later on.
tl;dr
Refactor the file walk to use C++ <filesystem>
which should resolve portability concerns and make your code much simpler.
I've made a few other suggestions in my review as well.
Joel, load_corpus_folder() logic converted to c++17 to simplify code |
Based on error messages I guess the issue was in FS namespace for Windows. |
Joel, What should be the next step? |
All of the tests need to pass. The Linux "with C++" tests are aimed at the C++ bindings, and are probably passing because they do not rely on the new code yet. There is code in |
I set c++17 standard in Great idea to use a container, I will setup it up once, and then it will speed-up testing for me. |
Joel,
Should I adjust |
The "warning" lines can be ignored. The cause for the failure is the messages below the warnings:
You should only need to add an entry to |
headers configuration updated. |
Thank you once again for helping refactor the test suite, which is often overlooked. Your persistence in sticking with this through all of the requested modifications and portability concerns is especially commendable! |
refactor tests for invalid format items closing issue #193