[Lldb-commits] [lldb] r295443 - Fix VASprintfTest on darwin

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 17 05:27:50 PST 2017


Author: labath
Date: Fri Feb 17 07:27:50 2017
New Revision: 295443

URL: http://llvm.org/viewvc/llvm-project?rev=295443&view=rev
Log:
Fix VASprintfTest on darwin

The way of injecting an error into the printf call was not working on
darwin - the C library still happily format the character. It only
returns an error after we use a wide character that does not fit into a
single byte, so switch the test to use that.

Modified:
    lldb/trunk/unittests/Utility/VASprintfTest.cpp

Modified: lldb/trunk/unittests/Utility/VASprintfTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/VASprintfTest.cpp?rev=295443&r1=295442&r2=295443&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/VASprintfTest.cpp (original)
+++ lldb/trunk/unittests/Utility/VASprintfTest.cpp Fri Feb 17 07:27:50 2017
@@ -49,11 +49,11 @@ TEST(VASprintfTest, EncodingError) {
   setlocale(LC_ALL, ".932");
 
   wchar_t Invalid[2];
-  Invalid[0] = 129;
+  Invalid[0] = 0x100;
   Invalid[1] = 0;
   llvm::SmallString<32> Buffer;
   EXPECT_FALSE(Sprintf(Buffer, "%ls", Invalid));
   EXPECT_EQ("<Encoding error>", Buffer);
 
-  setlocale(LC_CTYPE, Current.c_str());
+  setlocale(LC_ALL, Current.c_str());
 }




More information about the lldb-commits mailing list