diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-23 04:10:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-23 04:10:52 +0000 |
commit | 85f9a2650850b181208492de61822cf840ee62e5 (patch) | |
tree | f2ba509bc1f23e871c5e0e9d569fb82c68280e50 /test/libapt/configuration_test.cc | |
parent | Releasing progress-linux version 2.9.1-0.0~progress7.99u1. (diff) | |
download | apt-85f9a2650850b181208492de61822cf840ee62e5.tar.xz apt-85f9a2650850b181208492de61822cf840ee62e5.zip |
Merging upstream version 2.9.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/libapt/configuration_test.cc')
-rw-r--r-- | test/libapt/configuration_test.cc | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc index 4d297a9..37bc5ff 100644 --- a/test/libapt/configuration_test.cc +++ b/test/libapt/configuration_test.cc @@ -6,7 +6,7 @@ #include <string> #include <vector> -#include <gtest/gtest.h> +#include "common.h" #include "file-helpers.h" @@ -230,3 +230,35 @@ List::Option2 { "Multi"; EXPECT_TRUE(Cnf.FindB("Trailing")); EXPECT_FALSE(Cnf.Exists("Commented::Out")); } + +TEST(ConfigurationTest, Color) +{ + _config->Clear(); + _config->Set("APT::Color::Neutral", "\x1B[N"); + _config->Set("APT::Color::Green", "\x1B[G"); + // This is escaped for extra fun + _config->Set("APT::Color::Bold", "\\x1B[B"); + _config->Set("APT::Color::BoldGreen", "bold green"); + _config->Set("APT::Color::BoldGreenRef", "boldgreen"); + _config->Set("APT::Color::BoldGreenNeutral", "boldgreen neutral"); + _config->Set("APT::Color::BoldGreenRefNeutral", "boldgreenref neutral"); + + EXPECT_EQ("", APT::Configuration::color("bold")); + EXPECT_EQ("", APT::Configuration::color("green")); + EXPECT_EQ("content", APT::Configuration::color("green", "content")); + EXPECT_EQ("", APT::Configuration::color("boldgreen")); + EXPECT_EQ("", APT::Configuration::color("boldgreenref")); + EXPECT_EQ("", APT::Configuration::color("boldgreenneutral")); + EXPECT_EQ("", APT::Configuration::color("boldgreenrefneutral")); + + _config->Set("APT::Color", "true"); + EXPECT_EQ("\x1B[B", APT::Configuration::color("bold")); + EXPECT_EQ("\x1B[G", APT::Configuration::color("green")); + EXPECT_EQ("\x1B[Gcontent\x1B[N", APT::Configuration::color("green", "content")); + EXPECT_EQ("\x1B[B\x1B[G", APT::Configuration::color("boldgreen")); + EXPECT_EQ("\x1B[B\x1B[G", APT::Configuration::color("boldgreenref")); + EXPECT_EQ("\x1B[B\x1B[G\x1B[N", APT::Configuration::color("boldgreenneutral")); + EXPECT_EQ("\x1B[B\x1B[G\x1B[N", APT::Configuration::color("boldgreenrefneutral")); + // Reset for other tests + _config->Clear(); +} |