More +.UTF-8 fixes.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140262 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Chisnall 2011-09-21 17:35:42 +00:00
parent 709c3d27f5
commit 86698890db
20 changed files with 31 additions and 31 deletions

View File

@ -27,7 +27,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
const std::collate<char>& f = std::use_facet<std::collate<char> >(l); const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
std::string s2("aaaaaaA"); std::string s2("aaaaaaA");

View File

@ -21,7 +21,7 @@
int main() int main()
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
std::string x1("1234"); std::string x1("1234");
std::string x2("12345"); std::string x2("12345");

View File

@ -22,9 +22,9 @@
int main() int main()
{ {
// Ensure that the default locale is not C. If it is, the second tests will fail. // Ensure that the default locale is not C. If it is, the second tests will fail.
setenv("LANG", "en_US", 1); setenv("LANG", "en_US.UTF-8", 1);
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
std::string x("1234"); std::string x("1234");
const std::collate<char>& f = std::use_facet<std::collate<char> >(l); const std::collate<char>& f = std::use_facet<std::collate<char> >(l);

View File

@ -29,7 +29,7 @@
int main() int main()
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
assert(std::has_facet<std::collate_byname<char> >(l)); assert(std::has_facet<std::collate_byname<char> >(l));
assert(&std::use_facet<std::collate<char> >(l) assert(&std::use_facet<std::collate<char> >(l)

View File

@ -38,12 +38,12 @@ int my_facet::count = 0;
int main() int main()
{ {
{ {
std::locale l(std::locale::classic(), new my_facet("en_US")); std::locale l(std::locale::classic(), new my_facet("en_US.UTF-8"));
assert(my_facet::count == 1); assert(my_facet::count == 1);
} }
assert(my_facet::count == 0); assert(my_facet::count == 0);
{ {
my_facet f("en_US", 1); my_facet f("en_US.UTF-8", 1);
assert(my_facet::count == 1); assert(my_facet::count == 1);
{ {
std::locale l(std::locale::classic(), &f); std::locale l(std::locale::classic(), &f);
@ -53,12 +53,12 @@ int main()
} }
assert(my_facet::count == 0); assert(my_facet::count == 0);
{ {
std::locale l(std::locale::classic(), new my_facet(std::string("en_US"))); std::locale l(std::locale::classic(), new my_facet(std::string("en_US.UTF-8")));
assert(my_facet::count == 1); assert(my_facet::count == 1);
} }
assert(my_facet::count == 0); assert(my_facet::count == 0);
{ {
my_facet f(std::string("en_US"), 1); my_facet f(std::string("en_US.UTF-8"), 1);
assert(my_facet::count == 1); assert(my_facet::count == 1);
{ {
std::locale l(std::locale::classic(), &f); std::locale l(std::locale::classic(), &f);

View File

@ -20,7 +20,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -23,7 +23,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -39,7 +39,7 @@ int main()
} }
} }
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -23,7 +23,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -23,7 +23,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -19,7 +19,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<char> F; typedef std::ctype<char> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);
@ -51,7 +51,7 @@ int main()
} }
} }
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -20,7 +20,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<char> F; typedef std::ctype<char> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);
@ -54,7 +54,7 @@ int main()
} }
} }
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -19,7 +19,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<char> F; typedef std::ctype<char> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);
@ -51,7 +51,7 @@ int main()
} }
} }
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -20,7 +20,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<char> F; typedef std::ctype<char> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);
@ -54,7 +54,7 @@ int main()
} }
} }
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -28,7 +28,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
assert(std::has_facet<std::ctype_byname<char> >(l)); assert(std::has_facet<std::ctype_byname<char> >(l));
assert(&std::use_facet<std::ctype<char> >(l) assert(&std::use_facet<std::ctype<char> >(l)

View File

@ -22,7 +22,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -23,7 +23,7 @@
int main() int main()
{ {
{ {
std::locale l("en_US"); std::locale l("en_US.UTF-8");
{ {
typedef std::ctype<wchar_t> F; typedef std::ctype<wchar_t> F;
const F& f = std::use_facet<F>(l); const F& f = std::use_facet<F>(l);

View File

@ -21,7 +21,7 @@ int main()
assert(loc.name() == "C"); assert(loc.name() == "C");
} }
{ {
std::locale loc("en_US"); std::locale loc("en_US.UTF-8");
assert(loc.name() == "en_US"); assert(loc.name() == "en_US.UTF-8");
} }
} }

View File

@ -18,8 +18,8 @@ int main()
{ {
std::locale cloc; std::locale cloc;
std::locale copy(cloc); std::locale copy(cloc);
std::locale n1("en_US"); std::locale n1("en_US.UTF-8");
std::locale n2("en_US"); std::locale n2("en_US.UTF-8");
std::locale noname1 = n1.combine<std::ctype<char> >(cloc); std::locale noname1 = n1.combine<std::ctype<char> >(cloc);
std::locale nonamec = noname1; std::locale nonamec = noname1;
std::locale noname2 = n1.combine<std::ctype<char> >(cloc); std::locale noname2 = n1.combine<std::ctype<char> >(cloc);

View File

@ -54,8 +54,8 @@ int main()
std::locale loc; std::locale loc;
assert(loc.name() == "C"); assert(loc.name() == "C");
check(loc); check(loc);
assert(std::locale::global(std::locale("en_US")) == loc); assert(std::locale::global(std::locale("en_US.UTF-8")) == loc);
std::locale loc2; std::locale loc2;
check(loc2); check(loc2);
assert(loc2 == std::locale("en_US")); assert(loc2 == std::locale("en_US.UTF-8"));
} }