Debian Codegraph @

libstdc++-v3/testsuite/libstdc++-prettyprinters/locale.cc

raw
1 // { dg-do run }
2 // { dg-options "-g -O0" }
3 // { dg-require-namedlocale "fr_FR.ISO8859-15" }
4 // { dg-require-namedlocale "de_DE.ISO8859-15" }
5 // { dg-require-namedlocale "en_US.ISO8859-1" }
6
7 #include <locale>
8 #include <testsuite_hooks.h> // for ISO_8859 macro
9
10 int main()
11 {
12 std::locale l1 = std::locale::classic();
13 // { dg-final { note-test l1 {std::locale = "C"} } }
14
15 std::locale l2(ISO_8859(15,fr_FR));
16 // { dg-final { regexp-test l2 {std::locale = "fr_FR.ISO8859-15(@euro)?"} } }
17
18 std::locale l3(l2, ISO_8859(15,de_DE), std::locale::time);
19 // { dg-final { regexp-test l3 {std::locale = "fr_FR.ISO8859-15(@euro)?" with "LC_TIME=de_DE.ISO8859-15(@euro)?"} } }
20
21 std::locale l4(l3, ISO_8859(1,en_US), std::locale::monetary);
22 // We don't know which order the categories will occur in the string,
23 // so test three times, checking for the required substring each time:
24 // { dg-final { regexp-test l4 {std::locale = "(.*;)?LC_CTYPE=fr_FR.ISO8859-15(@euro)?(;.*)?"} } }
25 std::locale l5 = l4;
26 // { dg-final { regexp-test l5 {std::locale = "(.*;)?LC_TIME=de_DE.ISO8859-15(@euro)?(;.*)?"} } }
27 std::locale l6 = l5;
28 // { dg-final { regexp-test l6 {std::locale = "(.*;)?LC_MONETARY=en_US.ISO8859-1(;.*)?"} } }
29
30 std::locale l7(l1, &std::use_facet<std::ctype<char> >(l1));
31 // { dg-final { regexp-test l7 {std::locale = "\*"} } }
32
33 return 0; // Mark SPOT
34 }
35
36 // { dg-final { gdb-test SPOT } }