Skip to content

Truly independent web browser

LibGC: Link unit tests into one executable

Timothy Flynn789c08666588
diff --git a/Tests/LibGC/CMakeLists.txt b/Tests/LibGC/CMakeLists.txt
index f525d08f27b..5539e9e341a 100644
--- a/Tests/LibGC/CMakeLists.txt
+++ b/Tests/LibGC/CMakeLists.txt
@@ -1,3 +1,5 @@
+ladybird_test_suite(LibGC)
+
set(TEST_SOURCES
TestBlockAllocator.cpp
TestExternalEntityTable.cpp
@@ -6,11 +8,10 @@ set(TEST_SOURCES
TestGCHeapGroup.cpp
TestGCIdleCollection.cpp
TestGCIncrementalSweep.cpp
- TestPrimitiveStorage.cpp
TestGCVisitor.cpp
TestNanBoxedValue.cpp
+ TestPrimitiveStorage.cpp
)
-foreach(source IN LISTS TEST_SOURCES)
- ladybird_test("${source}" LibGC LIBS LibGC)
-endforeach()
+target_sources(TestLibGC PRIVATE ${TEST_SOURCES})
+target_link_libraries(TestLibGC PRIVATE LibGC)
diff --git a/Tests/LibGC/TestGCContainers.cpp b/Tests/LibGC/TestGCContainers.cpp
index 8a784959165..e90132df6a0 100644
--- a/Tests/LibGC/TestGCContainers.cpp
+++ b/Tests/LibGC/TestGCContainers.cpp
@@ -23,6 +23,8 @@
#include <LibGC/WeakHashMap.h>
#include <LibTest/TestCase.h>
+namespace {
+
class TestCell : public GC::Cell {
GC_CELL(TestCell, GC::Cell);
GC_DECLARE_ALLOCATOR(TestCell);
@@ -743,3 +745,5 @@ TEST_CASE(weak_pointers_to_dead_cells_are_null_while_finalizing)
EXPECT(weak_cell_was_null_while_finalizing);
EXPECT(weak_to_self_was_null_while_finalizing);
}
+
+}
diff --git a/Tests/LibGC/TestGCVisitor.cpp b/Tests/LibGC/TestGCVisitor.cpp
index f2d86b8c216..1efe9a8a669 100644
--- a/Tests/LibGC/TestGCVisitor.cpp
+++ b/Tests/LibGC/TestGCVisitor.cpp
@@ -18,6 +18,8 @@
#include <LibGC/Ptr.h>
#include <LibTest/TestCase.h>
+namespace {
+
class TestCell : public GC::Cell {
GC_CELL(TestCell, GC::Cell);
GC_DECLARE_ALLOCATOR(TestCell);
@@ -389,3 +391,5 @@ static_assert(!GC::IsVisitable<Optional<int>>::value);
static_assert(GC::IsVisitable<Variant<GC::Ref<TestCell>, int>>::value);
static_assert(!GC::IsVisitable<Variant<int, double>>::value);
+
+}
diff --git a/Tests/LibGC/TestNanBoxedValue.cpp b/Tests/LibGC/TestNanBoxedValue.cpp
index c9eacaa3499..986fe8bbb91 100644
--- a/Tests/LibGC/TestNanBoxedValue.cpp
+++ b/Tests/LibGC/TestNanBoxedValue.cpp
@@ -15,6 +15,8 @@
#include <LibGC/WeakInlines.h>
#include <LibTest/TestCase.h>
+namespace {
+
class TestCell final : public GC::Cell {
GC_CELL(TestCell, GC::Cell);
GC_DECLARE_ALLOCATOR(TestCell);
@@ -96,3 +98,5 @@ TEST_CASE(conservative_scanner_decodes_caged_value)
heap.collect_garbage(GC::Heap::CollectionType::CollectEverything);
EXPECT(!weak_cell);
}
+
+}