From 62e1060d11d585bc409ceb6d01b34df186b9ca06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Wed, 20 Mar 2024 21:25:00 +0200
Subject: [PATCH] test: add provides test case from #10973

The actual issue would not have been caught by this, because
it happened only with apkv3 indexes where the adb entry was
decoded incorrectly to apk_dependency structure.

Commit 1ab7f311 fixes the code to work even with the different
decoding of such provides.

And commit 82bcfcc8 fixed the actual decoding to work now same
as in apkv2 side.
---
 test/provides.repo   | 20 ++++++++++++++++++++
 test/provides16.test | 10 ++++++++++
 test/provides17.test |  7 +++++++
 3 files changed, 37 insertions(+)
 create mode 100644 test/provides16.test
 create mode 100644 test/provides17.test

diff --git a/test/provides.repo b/test/provides.repo
index 75ede8c7..25a0d4e3 100644
--- a/test/provides.repo
+++ b/test/provides.repo
@@ -148,3 +148,23 @@ I:1
 i:sane-backends
 p:hplip-sane
 
+C:Q1FFN5AdpAOBJWKMR89pp/C66o+OE=
+P:testp
+V:0.1-r0
+S:1
+I:1
+p:foopkg
+
+C:Q1FFN5AdpAOBJWKMR89pp/C66o+FE=
+P:testq
+V:0.1-r0
+S:1
+I:1
+p:foopkg
+
+C:Q1FFpkasfqZAukAXFYbgwt4xAMZWU=
+P:testr
+V:0.1-r0
+S:1
+I:1
+D:foopkg
diff --git a/test/provides16.test b/test/provides16.test
new file mode 100644
index 00000000..cb63cf81
--- /dev/null
+++ b/test/provides16.test
@@ -0,0 +1,10 @@
+@ARGS
+--test-repo provides.repo
+add testr
+@EXPECT
+ERROR: unable to select packages:
+  foopkg (virtual):
+    note: please select one of the 'provided by'
+          packages explicitly
+    provided by: testp testq
+    required by: testr-0.1-r0[foopkg]
diff --git a/test/provides17.test b/test/provides17.test
new file mode 100644
index 00000000..30dfc1be
--- /dev/null
+++ b/test/provides17.test
@@ -0,0 +1,7 @@
+@ARGS
+--test-repo provides.repo
+add testp testr
+@EXPECT
+(1/2) Installing testp (0.1-r0)
+(2/2) Installing testr (0.1-r0)
+OK: 0 MiB in 0 packages
-- 
GitLab