Crafter.Build/tests/SiblingOwnPointers/fixture/project.cpp
Jorijn van der Graaf 1440e20231
test(external): a sibling's pointers to its own Configuration hold
SiblingOwnPointers loads a fixture through LocalProject, on a fresh copy
outside the checkout: a library whose project file declares a test with
cfg.AddTest("OwnTest").Dependencies({ &cfg }). The one dependency of
that test has to be the Configuration LocalProject returns. The test
reads the dependency out of that Configuration and compares the two
addresses, without following the dependency.

Against the loader as it was before the fix the test fails: the
dependency is not that Configuration.
2026-11-14 23:42:47 +01:00

20 lines
693 B
C++

// SPDX-License-Identifier: LGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
import std;
import Crafter.Build;
using namespace Crafter;
// A library whose test depends on it: the test's dependency is a pointer to
// the Configuration this function returns. A library with no sources is
// enough, since the test that loads this file reads the pointer and builds
// nothing.
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view>) {
Configuration cfg;
cfg.path = "./";
cfg.name = "own";
cfg.outputName = "own";
cfg.type = ConfigurationType::LibraryStatic;
cfg.AddTest("OwnTest").Dependencies({ &cfg });
return cfg;
}