[libcxx] r215417 - Change two tests to be less dependant on locales.

Eric Fiselier eric at efcs.ca
Mon Aug 11 17:48:56 PDT 2014


Author: ericwf
Date: Mon Aug 11 19:48:56 2014
New Revision: 215417

URL: http://llvm.org/viewvc/llvm-project?rev=215417&view=rev
Log:
Change two tests to be less dependant on locales.

This patch removes the use of the "%c" specifier for getting/setting times.
The semantics of this specifier differ between linux and Mac. I don't believe
the use of this specifier was important to the test.

The following tests now pass on linux.
test/input.output/iostream.format/ext.manip/get_time.pass.cpp
test/input.output/iostream.format/ext.manip/put_time.pass.cpp

Modified:
    libcxx/trunk/test/input.output/iostream.format/ext.manip/get_time.pass.cpp
    libcxx/trunk/test/input.output/iostream.format/ext.manip/put_time.pass.cpp

Modified: libcxx/trunk/test/input.output/iostream.format/ext.manip/get_time.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/iostream.format/ext.manip/get_time.pass.cpp?rev=215417&r1=215416&r2=215417&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/iostream.format/ext.manip/get_time.pass.cpp (original)
+++ libcxx/trunk/test/input.output/iostream.format/ext.manip/get_time.pass.cpp Mon Aug 11 19:48:56 2014
@@ -43,7 +43,7 @@ int main()
         std::istream is(&sb);
         is.imbue(std::locale(LOCALE_en_US_UTF_8));
         std::tm t = {0};
-        is >> std::get_time(&t, "%c");
+        is >> std::get_time(&t, "%a %b %d %H:%M:%S %Y");
         assert(t.tm_sec == 59);
         assert(t.tm_min == 55);
         assert(t.tm_hour == 23);
@@ -59,7 +59,7 @@ int main()
         std::wistream is(&sb);
         is.imbue(std::locale(LOCALE_en_US_UTF_8));
         std::tm t = {0};
-        is >> std::get_time(&t, L"%c");
+        is >> std::get_time(&t, L"%a %b %d %H:%M:%S %Y");
         assert(t.tm_sec == 59);
         assert(t.tm_min == 55);
         assert(t.tm_hour == 23);

Modified: libcxx/trunk/test/input.output/iostream.format/ext.manip/put_time.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/iostream.format/ext.manip/put_time.pass.cpp?rev=215417&r1=215416&r2=215417&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/iostream.format/ext.manip/put_time.pass.cpp (original)
+++ libcxx/trunk/test/input.output/iostream.format/ext.manip/put_time.pass.cpp Mon Aug 11 19:48:56 2014
@@ -62,7 +62,8 @@ int main()
         t.tm_mon = 11;
         t.tm_year = 161;
         t.tm_wday = 6;
-        os << std::put_time(&t, "%c");
+        t.tm_isdst = 0;
+        os << std::put_time(&t, "%a %b %d %H:%M:%S %Y");
         assert(sb.str() == "Sat Dec 31 23:55:59 2061");
     }
     {
@@ -77,7 +78,7 @@ int main()
         t.tm_mon = 11;
         t.tm_year = 161;
         t.tm_wday = 6;
-        os << std::put_time(&t, L"%c");
+        os << std::put_time(&t, L"%a %b %d %H:%M:%S %Y");
         assert(sb.str() == L"Sat Dec 31 23:55:59 2061");
     }
 }





More information about the cfe-commits mailing list