summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-09-09 16:45:39 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-09-11 14:52:07 +0200
commitec4187721eafaef47c90506d86f92c391b98a3fa (patch)
tree71a32dc389101ab9c6ee449ca4ebfb3d417eed9d /test
parent64a121ca3fc6b16f9c6595ab59441f730c889e01 (diff)
downloadjustbuild-ec4187721eafaef47c90506d86f92c391b98a3fa.tar.gz
Use HashInfo to create ObjectInfo FromString
Diffstat (limited to 'test')
-rw-r--r--test/buildtool/main/TARGETS1
-rw-r--r--test/buildtool/main/install_cas.test.cpp33
2 files changed, 16 insertions, 18 deletions
diff --git a/test/buildtool/main/TARGETS b/test/buildtool/main/TARGETS
index af6e228a..1e77cdb9 100644
--- a/test/buildtool/main/TARGETS
+++ b/test/buildtool/main/TARGETS
@@ -8,7 +8,6 @@
, ["@", "src", "src/buildtool/common", "common"]
, ["@", "src", "src/buildtool/main", "install_cas"]
, ["@", "src", "src/buildtool/crypto", "hash_function"]
- , ["@", "src", "src/buildtool/compatibility", "compatibility"]
]
, "stage": ["test", "buildtool", "main"]
}
diff --git a/test/buildtool/main/install_cas.test.cpp b/test/buildtool/main/install_cas.test.cpp
index 8e9bc121..b74ef143 100644
--- a/test/buildtool/main/install_cas.test.cpp
+++ b/test/buildtool/main/install_cas.test.cpp
@@ -16,12 +16,15 @@
#include "catch2/catch_test_macros.hpp"
#include "src/buildtool/common/artifact.hpp"
-#include "src/buildtool/compatibility/compatibility.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
TEST_CASE("ObjectInfoFromLiberalString", "[artifact]") {
auto expected = *Artifact::ObjectInfo::FromString(
+ HashFunction::Type::GitSHA1,
"[5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689:11:f]");
+ auto expected_as_tree = *Artifact::ObjectInfo::FromString(
+ HashFunction::Type::GitSHA1,
+ "[5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689:0:t]");
// Check (default) file hashes
CHECK(ObjectInfoFromLiberalString(
@@ -66,20 +69,16 @@ TEST_CASE("ObjectInfoFromLiberalString", "[artifact]") {
/*has_remote=*/false) == expected);
// Check tree hashes
- if (not Compatibility::IsCompatible()) {
- auto expected_as_tree = *Artifact::ObjectInfo::FromString(
- "[5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689:0:t]");
- CHECK(ObjectInfoFromLiberalString(
- HashFunction::Type::GitSHA1,
- "5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689::t",
- /*has_remote=*/false) == expected_as_tree);
- CHECK(ObjectInfoFromLiberalString(
- HashFunction::Type::GitSHA1,
- "5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689::tree",
- /*has_remote=*/false) == expected_as_tree);
- CHECK(ObjectInfoFromLiberalString(
- HashFunction::Type::GitSHA1,
- "5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689:xyz:t",
- /*has_remote=*/false) == expected_as_tree);
- }
+ CHECK(ObjectInfoFromLiberalString(
+ HashFunction::Type::GitSHA1,
+ "5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689::t",
+ /*has_remote=*/false) == expected_as_tree);
+ CHECK(ObjectInfoFromLiberalString(
+ HashFunction::Type::GitSHA1,
+ "5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689::tree",
+ /*has_remote=*/false) == expected_as_tree);
+ CHECK(ObjectInfoFromLiberalString(
+ HashFunction::Type::GitSHA1,
+ "5e1c309dae7f45e0f39b1bf3ac3cd9db12e7d689:xyz:t",
+ /*has_remote=*/false) == expected_as_tree);
}