diff options
Diffstat (limited to 'test')
10 files changed, 120 insertions, 90 deletions
diff --git a/test/buildtool/build_engine/expression/TARGETS b/test/buildtool/build_engine/expression/TARGETS index a4d56e57..e7d15616 100644 --- a/test/buildtool/build_engine/expression/TARGETS +++ b/test/buildtool/build_engine/expression/TARGETS @@ -19,6 +19,7 @@ , ["", "catch-main"] , ["utils", "container_matchers"] , ["@", "src", "src/buildtool/build_engine/expression", "expression"] + , ["@", "src", "src/buildtool/common", "common"] ] , "stage": ["test", "buildtool", "build_engine", "expression"] } diff --git a/test/buildtool/build_engine/expression/expression.test.cpp b/test/buildtool/build_engine/expression/expression.test.cpp index 0bc5439b..8dd0aa92 100644 --- a/test/buildtool/build_engine/expression/expression.test.cpp +++ b/test/buildtool/build_engine/expression/expression.test.cpp @@ -22,6 +22,7 @@ #include "src/buildtool/build_engine/expression/configuration.hpp" #include "src/buildtool/build_engine/expression/expression.hpp" #include "src/buildtool/build_engine/expression/function_map.hpp" +#include "src/buildtool/common/artifact_description.hpp" #include "test/utils/container_matchers.hpp" TEST_CASE("Expression access", "[expression]") { // NOLINT @@ -38,7 +39,8 @@ TEST_CASE("Expression access", "[expression]") { // NOLINT auto boolean = ExpressionPtr{true}; auto number = ExpressionPtr{number_t{1}}; auto string = ExpressionPtr{"2"s}; - auto artifact = ExpressionPtr{artifact_t{path{"local_path"}}}; + auto artifact = + ExpressionPtr{ArtifactDescription::CreateTree(path{"local_path"})}; auto result = ExpressionPtr{result_t{boolean, number, string}}; auto list = ExpressionPtr{list_t{number}}; auto map = ExpressionPtr{map_t{{"3"s, number}}}; @@ -78,7 +80,8 @@ TEST_CASE("Expression access", "[expression]") { // NOLINT CHECK(string->String() == "2"s); CHECK_THROWS_AS(string->Artifact(), Expression::ExpressionTypeError); - CHECK(artifact->Artifact() == artifact_t{path{"local_path"}}); + CHECK(artifact->Artifact() == + ArtifactDescription::CreateTree(path{"local_path"})); CHECK_THROWS_AS(artifact->String(), Expression::ExpressionTypeError); CHECK(result->Result() == result_t{boolean, number, string}); @@ -154,13 +157,14 @@ TEST_CASE("Expression access", "[expression]") { // NOLINT CHECK(string == Expression::FromJson(R"("2")"_json)); CHECK(string != ""s); CHECK(string != Expression{""s}); - CHECK(string != artifact_t{path{"local_path"}}); + CHECK(string != ArtifactDescription::CreateTree(path{"local_path"})); CHECK(string != artifact); CHECK(string != Expression::FromJson(R"("")"_json)); CHECK(artifact == artifact); - CHECK(artifact == artifact_t{path{"local_path"}}); - CHECK(artifact == Expression{artifact_t{path{"local_path"}}}); + CHECK(artifact == ArtifactDescription::CreateTree(path{"local_path"})); + CHECK(artifact == + Expression{ArtifactDescription::CreateTree(path{"local_path"})}); CHECK(artifact != ""s); CHECK(artifact != string); @@ -191,16 +195,16 @@ TEST_CASE("Expression access", "[expression]") { // NOLINT CHECK(map != Expression::FromJson(R"(["3",1])"_json)); // compare nullptr != null != false != 0 != "" != [] != {} - auto exprs = - std::vector<ExpressionPtr>{ExpressionPtr{nullptr}, - ExpressionPtr{artifact_t{path{""}}}, - ExpressionPtr{result_t{}}, - Expression::FromJson("null"_json), - Expression::FromJson("false"_json), - Expression::FromJson("0"_json), - Expression::FromJson(R"("")"_json), - Expression::FromJson("[]"_json), - Expression::FromJson("{}"_json)}; + auto exprs = std::vector<ExpressionPtr>{ + ExpressionPtr{nullptr}, + ExpressionPtr{ArtifactDescription::CreateTree(path{""})}, + ExpressionPtr{result_t{}}, + Expression::FromJson("null"_json), + Expression::FromJson("false"_json), + Expression::FromJson("0"_json), + Expression::FromJson(R"("")"_json), + Expression::FromJson("[]"_json), + Expression::FromJson("{}"_json)}; for (auto const& l : exprs) { for (auto const& r : exprs) { if (&l != &r) { @@ -1697,7 +1701,7 @@ TEST_CASE("Expression hash computation", "[expression]") { auto boolean = ExpressionPtr{false}; auto number = ExpressionPtr{number_t{}}; auto string = ExpressionPtr{""s}; - auto artifact = ExpressionPtr{artifact_t{path{""}}}; + auto artifact = ExpressionPtr{ArtifactDescription::CreateTree(path{""})}; auto result = ExpressionPtr{result_t{}}; auto list = ExpressionPtr{list_t{}}; auto map = ExpressionPtr{map_t{}}; @@ -1718,9 +1722,11 @@ TEST_CASE("Expression hash computation", "[expression]") { CHECK_FALSE(string->ToHash() == Expression{" "s}.ToHash()); CHECK_FALSE(artifact->ToHash().empty()); - CHECK(artifact->ToHash() == Expression{artifact_t{path{""}}}.ToHash()); - CHECK_FALSE(artifact->ToHash() == - Expression{artifact_t{path{" "}}}.ToHash()); + CHECK(artifact->ToHash() == + Expression{ArtifactDescription::CreateTree(path{""})}.ToHash()); + CHECK_FALSE( + artifact->ToHash() == + Expression{ArtifactDescription::CreateTree(path{" "})}.ToHash()); CHECK_FALSE(result->ToHash().empty()); CHECK(result->ToHash() == Expression{result_t{}}.ToHash()); diff --git a/test/buildtool/common/action_description.test.cpp b/test/buildtool/common/action_description.test.cpp index 61361c58..9d82ec9d 100644 --- a/test/buildtool/common/action_description.test.cpp +++ b/test/buildtool/common/action_description.test.cpp @@ -18,16 +18,17 @@ #include "nlohmann/json.hpp" #include "src/buildtool/common/action.hpp" #include "src/buildtool/common/action_description.hpp" +#include "src/buildtool/common/artifact_description.hpp" #include "src/buildtool/common/artifact_factory.hpp" TEST_CASE("From JSON", "[action_description]") { using path = std::filesystem::path; - auto desc = - ActionDescription{{"output0", "output1"}, - {"dir0", "dir1"}, - Action{"id", {"command", "line"}, {{"env", "vars"}}}, - {{"path0", ArtifactDescription{path{"input0"}}}, - {"path1", ArtifactDescription{path{"input1"}}}}}; + auto desc = ActionDescription{ + {"output0", "output1"}, + {"dir0", "dir1"}, + Action{"id", {"command", "line"}, {{"env", "vars"}}}, + {{"path0", ArtifactDescription::CreateTree(path{"input0"})}, + {"path1", ArtifactDescription::CreateTree(path{"input1"})}}}; auto const& action = desc.GraphAction(); auto json = ArtifactFactory::DescribeAction(desc.OutputFiles(), desc.OutputDirs(), diff --git a/test/buildtool/common/artifact_description.test.cpp b/test/buildtool/common/artifact_description.test.cpp index 60d62961..d07efa93 100644 --- a/test/buildtool/common/artifact_description.test.cpp +++ b/test/buildtool/common/artifact_description.test.cpp @@ -28,8 +28,8 @@ } TEST_CASE("Local artifact", "[artifact_description]") { - auto local_desc = - ArtifactDescription{std::filesystem::path{"local_path"}, "repo"}; + auto local_desc = ArtifactDescription::CreateLocal( + std::filesystem::path{"local_path"}, "repo"); auto local = local_desc.ToArtifact(); auto local_from_factory = ArtifactFactory::FromDescription(local_desc.ToJson()); @@ -38,27 +38,27 @@ TEST_CASE("Local artifact", "[artifact_description]") { TEST_CASE("Known artifact", "[artifact_description]") { SECTION("File object") { - auto known_desc = ArtifactDescription{ + auto known_desc = ArtifactDescription::CreateKnown( ArtifactDigest{std::string{"f_fake_hash"}, 0, /*is_tree=*/false}, - ObjectType::File}; + ObjectType::File); auto known = known_desc.ToArtifact(); auto known_from_factory = ArtifactFactory::FromDescription(known_desc.ToJson()); CHECK(known == *known_from_factory); } SECTION("Executable object") { - auto known_desc = ArtifactDescription{ + auto known_desc = ArtifactDescription::CreateKnown( ArtifactDigest{std::string{"x_fake_hash"}, 1, /*is_tree=*/false}, - ObjectType::Executable}; + ObjectType::Executable); auto known = known_desc.ToArtifact(); auto known_from_factory = ArtifactFactory::FromDescription(known_desc.ToJson()); CHECK(known == *known_from_factory); } SECTION("Symlink object") { - auto known_desc = ArtifactDescription{ + auto known_desc = ArtifactDescription::CreateKnown( ArtifactDigest{std::string{"l_fake_hash"}, 2, /*is_tree=*/false}, - ObjectType::Symlink}; + ObjectType::Symlink); auto known = known_desc.ToArtifact(); auto known_from_factory = ArtifactFactory::FromDescription(known_desc.ToJson()); @@ -67,8 +67,8 @@ TEST_CASE("Known artifact", "[artifact_description]") { } TEST_CASE("Action artifact", "[artifact_description]") { - auto action_desc = - ArtifactDescription{"action_id", std::filesystem::path{"out_path"}}; + auto action_desc = ArtifactDescription::CreateAction( + "action_id", std::filesystem::path{"out_path"}); auto action = action_desc.ToArtifact(); auto action_from_factory = ArtifactFactory::FromDescription(action_desc.ToJson()); diff --git a/test/buildtool/execution_engine/dag/dag.test.cpp b/test/buildtool/execution_engine/dag/dag.test.cpp index 508c954e..cac4b791 100644 --- a/test/buildtool/execution_engine/dag/dag.test.cpp +++ b/test/buildtool/execution_engine/dag/dag.test.cpp @@ -130,7 +130,8 @@ TEST_CASE("AddAction({single action, more outputs, no inputs})", "[dag]") { TEST_CASE("AddAction({single action, single output, source file})", "[dag]") { using path = std::filesystem::path; std::string const action_id = "action_id"; - auto const src_description = ArtifactDescription{path{"main.cpp"}, "repo"}; + auto const src_description = + ArtifactDescription::CreateLocal(path{"main.cpp"}, "repo"); auto const& src_id = src_description.Id(); DependencyGraph g; SECTION("Input file in the same path than it is locally") { @@ -205,13 +206,17 @@ TEST_CASE("Add executable and library", "[dag]") { std::string const make_lib_id = "make_lib"; std::vector<std::string> const make_exec_cmd = {"build", "exec"}; std::vector<std::string> const make_lib_cmd = {"build", "lib.a"}; - auto const main_desc = ArtifactDescription{path{"main.cpp"}, ""}; + auto const main_desc = + ArtifactDescription::CreateLocal(path{"main.cpp"}, ""); auto const& main_id = main_desc.Id(); - auto const lib_hpp_desc = ArtifactDescription{path{"lib/lib.hpp"}, ""}; + auto const lib_hpp_desc = + ArtifactDescription::CreateLocal(path{"lib/lib.hpp"}, ""); auto const& lib_hpp_id = lib_hpp_desc.Id(); - auto const lib_cpp_desc = ArtifactDescription{path{"lib/lib.cpp"}, ""}; + auto const lib_cpp_desc = + ArtifactDescription::CreateLocal(path{"lib/lib.cpp"}, ""); auto const& lib_cpp_id = lib_cpp_desc.Id(); - auto const lib_a_desc = ArtifactDescription{make_lib_id, "lib.a"}; + auto const lib_a_desc = + ArtifactDescription::CreateAction(make_lib_id, "lib.a"); auto const& lib_a_id = lib_a_desc.Id(); auto const make_exec_desc = @@ -219,7 +224,8 @@ TEST_CASE("Add executable and library", "[dag]") { {}, Action{make_exec_id, make_exec_cmd, {}}, {{"main.cpp", main_desc}, {"lib.a", lib_a_desc}}}; - auto const& exec_out_id = ArtifactDescription{make_exec_id, "exec"}.Id(); + auto const& exec_out_id = + ArtifactDescription::CreateAction(make_exec_id, "exec").Id(); auto const make_lib_desc = ActionDescription{ {"lib.a"}, @@ -293,8 +299,10 @@ TEST_CASE("AddAction(Empty mandatory non-empty field in action description)", TEST_CASE("Adding cyclic dependencies produces invalid graph", "[dag]") { std::string const action1_id = "action1"; std::string const action2_id = "action2"; - auto const out1_desc = ArtifactDescription(action1_id, "out1"); - auto const out2_desc = ArtifactDescription(action2_id, "out2"); + auto const out1_desc = + ArtifactDescription::CreateAction(action1_id, "out1"); + auto const out2_desc = + ArtifactDescription::CreateAction(action2_id, "out2"); auto const action1_desc = ActionDescription{{"out1"}, diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp index dd9f59db..9dc2f667 100644 --- a/test/buildtool/execution_engine/executor/executor.test.cpp +++ b/test/buildtool/execution_engine/executor/executor.test.cpp @@ -234,9 +234,10 @@ class TestApi : public IExecutionApi { -> std::pair<TestApiConfig, RepositoryConfig> { using path = std::filesystem::path; - auto const local_cpp_desc = ArtifactDescription{path{"local.cpp"}, ""}; - auto const known_cpp_desc = ArtifactDescription{ - ArtifactDigest{"known.cpp", 0, /*is_tree=*/false}, ObjectType::File}; + auto const local_cpp_desc = + ArtifactDescription::CreateLocal(path{"local.cpp"}, ""); + auto const known_cpp_desc = ArtifactDescription::CreateKnown( + ArtifactDigest{"known.cpp", 0, /*is_tree=*/false}, ObjectType::File); auto const test_action_desc = ActionDescription{ {"output1.exe", "output2.exe"}, diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp index e499efae..18e30c70 100644 --- a/test/buildtool/execution_engine/executor/executor_api.test.hpp +++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp @@ -99,7 +99,7 @@ static inline void RunHelloWorldCompilation( using path = std::filesystem::path; SetupConfig(repo_config); auto const main_cpp_desc = - ArtifactDescription{path{"data/hello_world/main.cpp"}, ""}; + ArtifactDescription::CreateLocal(path{"data/hello_world/main.cpp"}, ""); auto const& main_cpp_id = main_cpp_desc.Id(); std::string const make_hello_id = "make_hello"; auto* env_path = std::getenv("PATH"); @@ -118,7 +118,7 @@ static inline void RunHelloWorldCompilation( env}, {{"src/main.cpp", main_cpp_desc}}}; auto const exec_desc = - ArtifactDescription{make_hello_id, "out/hello_world"}; + ArtifactDescription::CreateAction(make_hello_id, "out/hello_world"); auto const& exec_id = exec_desc.Id(); DependencyGraph g; @@ -174,10 +174,10 @@ static inline void RunGreeterCompilation( using path = std::filesystem::path; SetupConfig(repo_config); auto const greet_hpp_desc = - ArtifactDescription{path{"data/greeter/greet.hpp"}, ""}; + ArtifactDescription::CreateLocal(path{"data/greeter/greet.hpp"}, ""); auto const& greet_hpp_id = greet_hpp_desc.Id(); auto const greet_cpp_desc = - ArtifactDescription{path{"data/greeter"} / greetcpp, ""}; + ArtifactDescription::CreateLocal(path{"data/greeter"} / greetcpp, ""); auto const& greet_cpp_id = greet_cpp_desc.Id(); std::string const compile_greet_id = "compile_greet"; @@ -205,7 +205,7 @@ static inline void RunGreeterCompilation( {"src/greet.cpp", greet_cpp_desc}}}; auto const greet_o_desc = - ArtifactDescription{compile_greet_id, "out/greet.o"}; + ArtifactDescription::CreateAction(compile_greet_id, "out/greet.o"); auto const& greet_o_id = greet_o_desc.Id(); std::string const make_lib_id = "make_lib"; @@ -216,11 +216,11 @@ static inline void RunGreeterCompilation( {{"greet.o", greet_o_desc}}}; auto const main_cpp_desc = - ArtifactDescription{path{"data/greeter/main.cpp"}, ""}; + ArtifactDescription::CreateLocal(path{"data/greeter/main.cpp"}, ""); auto const& main_cpp_id = main_cpp_desc.Id(); auto const libgreet_desc = - ArtifactDescription{make_lib_id, "out/libgreet.a"}; + ArtifactDescription::CreateAction(make_lib_id, "out/libgreet.a"); auto const& libgreet_id = libgreet_desc.Id(); std::string const make_exe_id = "make_exe"; @@ -242,7 +242,8 @@ static inline void RunGreeterCompilation( {"include/greet.hpp", greet_hpp_desc}, {"lib/libgreet.a", libgreet_desc}}}; - auto const exec_id = ArtifactDescription(make_exe_id, "out/greeter").Id(); + auto const exec_id = + ArtifactDescription::CreateAction(make_exe_id, "out/greeter").Id(); DependencyGraph g; CHECK(g.Add({compile_greet_desc, make_lib_desc, make_exe_desc})); @@ -402,8 +403,10 @@ static inline void TestUploadAndDownloadTrees( ArtifactBlob{bar_digest, bar, /*is_exec=*/false}}})); // define known artifacts - auto foo_desc = ArtifactDescription{foo_digest, ObjectType::File}; - auto bar_desc = ArtifactDescription{bar_digest, ObjectType::Symlink}; + auto foo_desc = + ArtifactDescription::CreateKnown(foo_digest, ObjectType::File); + auto bar_desc = + ArtifactDescription::CreateKnown(bar_digest, ObjectType::Symlink); DependencyGraph g{}; auto foo_id = g.AddArtifact(foo_desc); @@ -560,7 +563,8 @@ static inline void TestRetrieveOutputDirectories( SECTION("entire action output as directory") { auto const make_tree_desc = create_action({}, {""}); - auto const root_desc = ArtifactDescription{make_tree_id, ""}; + auto const root_desc = + ArtifactDescription::CreateAction(make_tree_id, ""); DependencyGraph g{}; REQUIRE(g.AddAction(make_tree_desc)); @@ -605,9 +609,12 @@ static inline void TestRetrieveOutputDirectories( SECTION("disjoint files and directories") { auto const make_tree_desc = create_action({"foo", "bar"}, {"baz"}); - auto const foo_desc = ArtifactDescription{make_tree_id, "foo"}; - auto const bar_desc = ArtifactDescription{make_tree_id, "bar"}; - auto const baz_desc = ArtifactDescription{make_tree_id, "baz"}; + auto const foo_desc = + ArtifactDescription::CreateAction(make_tree_id, "foo"); + auto const bar_desc = + ArtifactDescription::CreateAction(make_tree_id, "bar"); + auto const baz_desc = + ArtifactDescription::CreateAction(make_tree_id, "baz"); DependencyGraph g{}; REQUIRE(g.AddAction(make_tree_desc)); @@ -669,10 +676,14 @@ static inline void TestRetrieveOutputDirectories( SECTION("nested files and directories") { auto const make_tree_desc = create_action({"foo", "baz/bar"}, {"", "baz/baz"}); - auto const root_desc = ArtifactDescription{make_tree_id, ""}; - auto const foo_desc = ArtifactDescription{make_tree_id, "foo"}; - auto const bar_desc = ArtifactDescription{make_tree_id, "baz/bar"}; - auto const baz_desc = ArtifactDescription{make_tree_id, "baz/baz"}; + auto const root_desc = + ArtifactDescription::CreateAction(make_tree_id, ""); + auto const foo_desc = + ArtifactDescription::CreateAction(make_tree_id, "foo"); + auto const bar_desc = + ArtifactDescription::CreateAction(make_tree_id, "baz/bar"); + auto const baz_desc = + ArtifactDescription::CreateAction(make_tree_id, "baz/baz"); DependencyGraph g{}; REQUIRE(g.AddAction(make_tree_desc)); @@ -750,7 +761,8 @@ static inline void TestRetrieveOutputDirectories( SECTION("non-existing outputs") { SECTION("non-existing file") { auto const make_tree_desc = create_action({"fool"}, {}); - auto const fool_desc = ArtifactDescription{make_tree_id, "fool"}; + auto const fool_desc = + ArtifactDescription::CreateAction(make_tree_id, "fool"); DependencyGraph g{}; REQUIRE(g.AddAction(make_tree_desc)); @@ -775,7 +787,8 @@ static inline void TestRetrieveOutputDirectories( SECTION("non-existing directory") { auto const make_tree_desc = create_action({"bazel"}, {}); - auto const bazel_desc = ArtifactDescription{make_tree_id, "bazel"}; + auto const bazel_desc = + ArtifactDescription::CreateAction(make_tree_id, "bazel"); DependencyGraph g{}; REQUIRE(g.AddAction(make_tree_desc)); diff --git a/test/buildtool/execution_engine/traverser/TARGETS b/test/buildtool/execution_engine/traverser/TARGETS index 9f1e1387..77603634 100644 --- a/test/buildtool/execution_engine/traverser/TARGETS +++ b/test/buildtool/execution_engine/traverser/TARGETS @@ -6,6 +6,7 @@ [ ["@", "catch2", "", "catch2"] , ["", "catch-main"] , ["utils", "container_matchers"] + , ["@", "src", "src/buildtool/common", "common"] , ["@", "src", "src/buildtool/common", "artifact_factory"] , ["@", "src", "src/buildtool/execution_engine/dag", "dag"] , ["@", "src", "src/buildtool/execution_engine/traverser", "traverser"] diff --git a/test/buildtool/execution_engine/traverser/traverser.test.cpp b/test/buildtool/execution_engine/traverser/traverser.test.cpp index 2354aaf1..150f3d8c 100644 --- a/test/buildtool/execution_engine/traverser/traverser.test.cpp +++ b/test/buildtool/execution_engine/traverser/traverser.test.cpp @@ -167,10 +167,9 @@ class TestProject { command.emplace_back("BUILD"); for (auto const& output : outputs) { command.push_back(output); - auto const out_id = ArtifactDescription{ - action_id, - std::filesystem::path{ - output}}.Id(); + auto const out_id = ArtifactDescription::CreateAction( + action_id, std::filesystem::path{output}) + .Id(); auto [_, is_inserted] = artifacts_to_be_built_.insert(out_id); if (!is_inserted) { return false; diff --git a/test/buildtool/file_system/file_root.test.cpp b/test/buildtool/file_system/file_root.test.cpp index e5f84cfb..1f7bf927 100644 --- a/test/buildtool/file_system/file_root.test.cpp +++ b/test/buildtool/file_system/file_root.test.cpp @@ -367,8 +367,8 @@ TEST_CASE("Creating artifact descriptions", "[file_root]") { auto desc = root.ToArtifactDescription("baz/foo", "repo"); REQUIRE(desc); - CHECK(*desc == - ArtifactDescription(std::filesystem::path{"baz/foo"}, "repo")); + CHECK(*desc == ArtifactDescription::CreateLocal( + std::filesystem::path{"baz/foo"}, "repo")); CHECK(root.ToArtifactDescription("does_not_exist", "repo")); } @@ -381,17 +381,17 @@ TEST_CASE("Creating artifact descriptions", "[file_root]") { auto foo = root->ToArtifactDescription("baz/foo", "repo"); REQUIRE(foo); - CHECK(*foo == - ArtifactDescription{ArtifactDigest{kFooId, 3, /*is_tree=*/false}, - ObjectType::File, - "repo"}); + CHECK(*foo == ArtifactDescription::CreateKnown( + ArtifactDigest{kFooId, 3, /*is_tree=*/false}, + ObjectType::File, + "repo")); auto bar = root->ToArtifactDescription("baz/bar", "repo"); REQUIRE(bar); - CHECK(*bar == - ArtifactDescription{ArtifactDigest{kBarId, 3, /*is_tree=*/false}, - ObjectType::Executable, - "repo"}); + CHECK(*bar == ArtifactDescription::CreateKnown( + ArtifactDigest{kBarId, 3, /*is_tree=*/false}, + ObjectType::Executable, + "repo")); CHECK_FALSE(root->ToArtifactDescription("baz", "repo")); CHECK_FALSE(root->ToArtifactDescription("does_not_exist", "repo")); @@ -404,8 +404,8 @@ TEST_CASE("Creating artifact descriptions", "[file_root]") { auto desc = root.ToArtifactDescription("baz/foo", "repo"); REQUIRE(desc); - CHECK(*desc == - ArtifactDescription(std::filesystem::path{"baz/foo"}, "repo")); + CHECK(*desc == ArtifactDescription::CreateLocal( + std::filesystem::path{"baz/foo"}, "repo")); CHECK(root.ToArtifactDescription("does_not_exist", "repo")); } @@ -419,17 +419,17 @@ TEST_CASE("Creating artifact descriptions", "[file_root]") { auto foo = root->ToArtifactDescription("baz/foo", "repo"); REQUIRE(foo); - CHECK(*foo == - ArtifactDescription{ArtifactDigest{kFooId, 3, /*is_tree=*/false}, - ObjectType::File, - "repo"}); + CHECK(*foo == ArtifactDescription::CreateKnown( + ArtifactDigest{kFooId, 3, /*is_tree=*/false}, + ObjectType::File, + "repo")); auto bar = root->ToArtifactDescription("baz/bar", "repo"); REQUIRE(bar); - CHECK(*bar == - ArtifactDescription{ArtifactDigest{kBarId, 3, /*is_tree=*/false}, - ObjectType::Executable, - "repo"}); + CHECK(*bar == ArtifactDescription::CreateKnown( + ArtifactDigest{kBarId, 3, /*is_tree=*/false}, + ObjectType::Executable, + "repo")); CHECK_FALSE(root->ToArtifactDescription("baz", "repo")); CHECK_FALSE(root->ToArtifactDescription("does_not_exist", "repo")); |