test(json2): build a decimal-comma locale for the numeric locale test

Linux runners have no decimal-comma locale, so guest_json_numeric_locale
skipped there. Build xx_COMMA from a charmap and an LC_NUMERIC source
shipped with the test as a CTest fixture, point the test at it with
LOCPATH and try it first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
SimoneandClaude Opus 5.5 committed 2026-10-22 10:03:09 +02:00
1 parent ebd1a14e30
commit e7ea986aa7
4 files changed
+150 -1

No files matched your search

+9
View File
@@ -10,6 +10,15 @@ if(BUILD_TESTING)
add_test(NAME guest_json COMMAND guest_json_tests)
add_test(NAME guest_json_numeric_locale COMMAND guest_json_tests --numeric-locale)
set_tests_properties(guest_json_numeric_locale PROPERTIES SKIP_RETURN_CODE 77)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(numeric_locale_dir ${CMAKE_CURRENT_BINARY_DIR}/numeric-locale)
set(numeric_locale_data ${LIBS_INCLUDE_DIR}/tests/numeric-locale)
add_test(NAME guest_json_numeric_locale_setup COMMAND sh -c
"rm -rf '${numeric_locale_dir}' && mkdir -p '${numeric_locale_dir}' && I18NPATH='${numeric_locale_dir}' localedef -c -f '${numeric_locale_data}/comma.charmap' -i '${numeric_locale_data}/comma.locale' '${numeric_locale_dir}/xx_COMMA'; test -f '${numeric_locale_dir}/xx_COMMA/LC_NUMERIC'")
set_tests_properties(guest_json_numeric_locale_setup PROPERTIES FIXTURES_SETUP json_numeric_locale)
set_tests_properties(guest_json_numeric_locale PROPERTIES FIXTURES_REQUIRED json_numeric_locale
ENVIRONMENT "LOCPATH=${numeric_locale_dir}")
endif()
if(WIN32)
set_tests_properties(guest_json guest_json_numeric_locale PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceJson2>")
+1 -1
View File
@@ -1380,7 +1380,7 @@ static void ValueOperatorBool() {
static int NumericLocale() {
const std::string previous = std::setlocale(LC_NUMERIC, nullptr);
const char* selected = nullptr;
for (const char* name : {"de_DE.UTF-8", "de_DE.utf8", "de-DE", "German_Germany.1252", "fr_FR.UTF-8"}) {
for (const char* name : {"xx_COMMA", "de_DE.UTF-8", "de_DE.utf8", "de-DE", "German_Germany.1252", "fr_FR.UTF-8"}) {
if (std::setlocale(LC_NUMERIC, name) && std::strcmp(std::localeconv()->decimal_point, ",") == 0) {
selected = name;
break;
@@ -0,0 +1,135 @@
<code_set_name> ANYPS5_COMMA
<comment_char> %
<escape_char> /
<mb_cur_max> 1
<mb_cur_min> 1
CHARMAP
<U0000> /x00
<U0001> /x01
<U0002> /x02
<U0003> /x03
<U0004> /x04
<U0005> /x05
<U0006> /x06
<U0007> /x07
<U0008> /x08
<U0009> /x09
<U000A> /x0a
<U000B> /x0b
<U000C> /x0c
<U000D> /x0d
<U000E> /x0e
<U000F> /x0f
<U0010> /x10
<U0011> /x11
<U0012> /x12
<U0013> /x13
<U0014> /x14
<U0015> /x15
<U0016> /x16
<U0017> /x17
<U0018> /x18
<U0019> /x19
<U001A> /x1a
<U001B> /x1b
<U001C> /x1c
<U001D> /x1d
<U001E> /x1e
<U001F> /x1f
<U0020> /x20
<U0021> /x21
<U0022> /x22
<U0023> /x23
<U0024> /x24
<U0025> /x25
<U0026> /x26
<U0027> /x27
<U0028> /x28
<U0029> /x29
<U002A> /x2a
<U002B> /x2b
<U002C> /x2c
<U002D> /x2d
<U002E> /x2e
<U002F> /x2f
<U0030> /x30
<U0031> /x31
<U0032> /x32
<U0033> /x33
<U0034> /x34
<U0035> /x35
<U0036> /x36
<U0037> /x37
<U0038> /x38
<U0039> /x39
<U003A> /x3a
<U003B> /x3b
<U003C> /x3c
<U003D> /x3d
<U003E> /x3e
<U003F> /x3f
<U0040> /x40
<U0041> /x41
<U0042> /x42
<U0043> /x43
<U0044> /x44
<U0045> /x45
<U0046> /x46
<U0047> /x47
<U0048> /x48
<U0049> /x49
<U004A> /x4a
<U004B> /x4b
<U004C> /x4c
<U004D> /x4d
<U004E> /x4e
<U004F> /x4f
<U0050> /x50
<U0051> /x51
<U0052> /x52
<U0053> /x53
<U0054> /x54
<U0055> /x55
<U0056> /x56
<U0057> /x57
<U0058> /x58
<U0059> /x59
<U005A> /x5a
<U005B> /x5b
<U005C> /x5c
<U005D> /x5d
<U005E> /x5e
<U005F> /x5f
<U0060> /x60
<U0061> /x61
<U0062> /x62
<U0063> /x63
<U0064> /x64
<U0065> /x65
<U0066> /x66
<U0067> /x67
<U0068> /x68
<U0069> /x69
<U006A> /x6a
<U006B> /x6b
<U006C> /x6c
<U006D> /x6d
<U006E> /x6e
<U006F> /x6f
<U0070> /x70
<U0071> /x71
<U0072> /x72
<U0073> /x73
<U0074> /x74
<U0075> /x75
<U0076> /x76
<U0077> /x77
<U0078> /x78
<U0079> /x79
<U007A> /x7a
<U007B> /x7b
<U007C> /x7c
<U007D> /x7d
<U007E> /x7e
<U007F> /x7f
END CHARMAP
@@ -0,0 +1,5 @@
LC_NUMERIC
decimal_point "<U002C>"
thousands_sep ""
grouping -1
END LC_NUMERIC