[pve-devel] [RFC PATCH pve-common 2/2] SectionConfig: add unit test for UTF-8 configs

Laurențiu Leahu-Vlăducu l.leahu-vladucu at proxmox.com
Fri Feb 14 16:40:40 CET 2025


The unit test should prevent the issues explained in bug #3256 from
happening in the future.

Signed-off-by: Laurențiu Leahu-Vlăducu <l.leahu-vladucu at proxmox.com>
---
 test/section_config_test.pl | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/test/section_config_test.pl b/test/section_config_test.pl
index 343e4c8..5629651 100755
--- a/test/section_config_test.pl
+++ b/test/section_config_test.pl
@@ -194,6 +194,31 @@ two: t3
 	another even more text
 EOF
 
+my $unicode_data = {
+    ids => {
+	    t1 => {
+		type => 'one',
+		common => Encode::decode('UTF-8', '🍕'),
+		field1 => 3,
+		another => Encode::decode('UTF-8', '🟥🟧🟨🟩🟦🟪🟫⬛️⬜️🧮🌈🇨🇭'),
+	    },
+	},
+	order => { t1 => 1 },
+};
+
+my $unicode_text = <<"EOF";
+one: t1
+	common 🍕
+	field1 3
+	another 🟥🟧🟨🟩🟦🟪🟫⬛️⬜️🧮🌈🇨🇭
+EOF
+
+Conf->expect_success(
+    'test_unicode',
+    $unicode_data,
+    $unicode_text);
+
+
 my $with_unknown_data = {
     ids => {
 	t1 => {
-- 
2.39.5





More information about the pve-devel mailing list