Repository: mesos
Updated Branches:
  refs/heads/master 5660d7633 -> e370b0997


Windows: Fixed Base64Test.EncodeURLSafe.

C++ encodes string literals in the compiling platform's encoding
of choice, which means UTF8 for Posix, and ANSI for Windows.

This has implications for this particular test, as the string literal
"~~~\u00ff\u00ff\u00ff\u00ff" is translated into different bytes:
  Posix:   { 126, 126, 126, 195, 191, 195, 191, 195, 191, 195, 191 }
  Windows: { 126, 126, 126,      255,      255,      255,      255 }

Prepending `u8` to the string literal tells the compiler to encode
the string as UTF8.  This does not expose any underlying bug(s)
on Windows because the test is only failing due to an incorrect input.

Review: https://reviews.apache.org/r/58430/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/703d0011
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/703d0011
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/703d0011

Branch: refs/heads/master
Commit: 703d0011d9049c6003f6d57026f5e764d1cb4435
Parents: 5660d76
Author: John Kordich <[email protected]>
Authored: Thu Apr 13 18:07:25 2017 -0700
Committer: Joseph Wu <[email protected]>
Committed: Thu Apr 13 18:07:25 2017 -0700

----------------------------------------------------------------------
 3rdparty/stout/tests/base64_tests.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/703d0011/3rdparty/stout/tests/base64_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/base64_tests.cpp 
b/3rdparty/stout/tests/base64_tests.cpp
index 0473221..a6837c8 100644
--- a/3rdparty/stout/tests/base64_tests.cpp
+++ b/3rdparty/stout/tests/base64_tests.cpp
@@ -56,12 +56,12 @@ TEST(Base64Test, EncodeURLSafe)
       base64::encode_url_safe("user:password~~~", true));
 
   EXPECT_EQ(
-      "fn5-w7_Dv8O_w78",
-      base64::encode_url_safe("~~~\u00ff\u00ff\u00ff\u00ff", false));
+      u8"fn5-w7_Dv8O_w78",
+      base64::encode_url_safe(u8"~~~\u00ff\u00ff\u00ff\u00ff", false));
 
   EXPECT_EQ(
-      "fn5-w7_Dv8O_w78=",
-      base64::encode_url_safe("~~~\u00ff\u00ff\u00ff\u00ff", true));
+      u8"fn5-w7_Dv8O_w78=",
+      base64::encode_url_safe(u8"~~~\u00ff\u00ff\u00ff\u00ff", true));
 }
 
 
@@ -76,10 +76,10 @@ TEST(Base64Test, DecodeURLSafe)
       base64::decode_url_safe("dXNlcjpwYXNzd29yZH5-fg=="));
 
   EXPECT_SOME_EQ(
-      "~~~\u00ff\u00ff\u00ff\u00ff",
-      base64::decode_url_safe("fn5-w7_Dv8O_w78"));
+      u8"~~~\u00ff\u00ff\u00ff\u00ff",
+      base64::decode_url_safe(u8"fn5-w7_Dv8O_w78"));
 
   EXPECT_SOME_EQ(
-      "~~~\u00ff\u00ff\u00ff\u00ff",
-      base64::decode_url_safe("fn5-w7_Dv8O_w78="));
+      u8"~~~\u00ff\u00ff\u00ff\u00ff",
+      base64::decode_url_safe(u8"fn5-w7_Dv8O_w78="));
 }

Reply via email to