feat(aur): add an AUR provider plugin
Community packages were invisible unless the user ran yay/paru by hand. Wrap the helper behind the provider interface, like the Flatpak plugin, so AUR results join search, installed and updates while staying optional. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
1 parent
edc3ef2925
commit
6d5b4274c4
4 files changed
+382
No files matched your search
@@ -0,0 +1,66 @@
|
||||
#include "aur-manager.h"
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
static void testParseSearchOutput_parsesPairs() {
|
||||
std::string output =
|
||||
"aur/yay 12.3.5-1 [installed]\n"
|
||||
" Yet another yogurt - pacman wrapper and AUR helper\n"
|
||||
"aur/paru 2.0.0-1\n"
|
||||
" Feature packed AUR helper\n";
|
||||
auto pkgs = AurManager::parseSearchOutput(output);
|
||||
|
||||
assert(pkgs.size() == 2);
|
||||
assert(pkgs[0].name == "yay");
|
||||
assert(pkgs[0].version == "12.3.5-1");
|
||||
assert(pkgs[0].installed);
|
||||
assert(pkgs[0].description.find("yogurt") != std::string::npos);
|
||||
assert(pkgs[1].name == "paru");
|
||||
assert(!pkgs[1].installed);
|
||||
}
|
||||
|
||||
static void testParseSearchOutput_emptyInput() {
|
||||
assert(AurManager::parseSearchOutput("").empty());
|
||||
}
|
||||
|
||||
static void testParseInstalledOutput_parsesNames() {
|
||||
std::string output = "yay 12.3.5-1\nparu 2.0.0-1\n";
|
||||
auto pkgs = AurManager::parseInstalledOutput(output);
|
||||
|
||||
assert(pkgs.size() == 2);
|
||||
assert(pkgs[0].name == "yay");
|
||||
assert(pkgs[0].installed);
|
||||
assert(pkgs[1].name == "paru");
|
||||
}
|
||||
|
||||
static void testParseInstalledOutput_emptyInput() {
|
||||
assert(AurManager::parseInstalledOutput("").empty());
|
||||
}
|
||||
|
||||
static void testParseUpdatesOutput_parsesArrows() {
|
||||
std::string output = "yay 12.3.4-1 -> 12.3.5-1\n";
|
||||
auto pkgs = AurManager::parseUpdatesOutput(output);
|
||||
|
||||
assert(pkgs.size() == 1);
|
||||
assert(pkgs[0].name == "yay");
|
||||
assert(pkgs[0].version == "12.3.5-1");
|
||||
assert(pkgs[0].updateAvailable);
|
||||
}
|
||||
|
||||
static void testParseUpdatesOutput_emptyInput() {
|
||||
assert(AurManager::parseUpdatesOutput("").empty());
|
||||
}
|
||||
|
||||
int main() {
|
||||
testParseSearchOutput_parsesPairs();
|
||||
testParseSearchOutput_emptyInput();
|
||||
|
||||
testParseInstalledOutput_parsesNames();
|
||||
testParseInstalledOutput_emptyInput();
|
||||
|
||||
testParseUpdatesOutput_parsesArrows();
|
||||
testParseUpdatesOutput_emptyInput();
|
||||
|
||||
std::cout << "All aur-manager tests passed." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user