mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:47:35 +00:00
Tests: Migrate to Directory::for_each_entry()
This commit is contained in:
parent
23aec16e8b
commit
728b07fbf6
3 changed files with 23 additions and 30 deletions
|
@ -5,9 +5,8 @@
|
|||
*/
|
||||
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibAudio/FlacLoader.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/Directory.h>
|
||||
#include <LibTest/TestCase.h>
|
||||
|
||||
struct FlacTest : Test::TestCase {
|
||||
|
@ -46,14 +45,12 @@ struct DiscoverFLACTestsHack {
|
|||
DiscoverFLACTestsHack()
|
||||
{
|
||||
// FIXME: Also run (our own) tests in this directory.
|
||||
auto test_iterator = Core::DirIterator { "./SpecTests", Core::DirIterator::Flags::SkipParentAndBaseDir };
|
||||
|
||||
while (test_iterator.has_next()) {
|
||||
auto file = LexicalPath { test_iterator.next_full_path() };
|
||||
if (file.extension() == "flac"sv) {
|
||||
Test::add_test_case_to_suite(make_ref_counted<FlacTest>(move(file)));
|
||||
}
|
||||
}
|
||||
(void)Core::Directory::for_each_entry("./SpecTests"sv, Core::DirIterator::Flags::SkipParentAndBaseDir, [](auto const& entry, auto const& directory) -> ErrorOr<IterationDecision> {
|
||||
auto path = LexicalPath::join(directory.path().string(), entry.name);
|
||||
if (path.extension() == "flac"sv)
|
||||
Test::add_test_case_to_suite(make_ref_counted<FlacTest>(path));
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
};
|
||||
// Hack taken from TEST_CASE; the above constructor will run as part of global initialization before the tests are actually executed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue