about summary refs log tree commit diff
path: root/absl/strings/substitute_test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-03-21T04·10-0700
committerkatzdm <katzdm@google.com>2018-03-21T14·51-0400
commit4e2e6c5c0071e6430056a8ef0a6c8a1fe584d8ff (patch)
tree37fb874b61a1ef7dac7cc6efa36de0b2cc2f40d7 /absl/strings/substitute_test.cc
parent506fb4b56a339314fde23802bd749dbc3b3c1c79 (diff)
Changes imported from Abseil "staging" branch:
  - 1320147f7597a9490562d439ecea46faa1793a24 Support Hex formatting of pointers without forcing a cast... by Jorg Brown <jorg@google.com>
  - 13c793d6e14a52063c2d4ee327b6c976631b690e Add support for native WebAssembly llvm backend. by Abseil Team <absl-team@google.com>

GitOrigin-RevId: 1320147f7597a9490562d439ecea46faa1793a24
Change-Id: Ibd4dbf288903ab45387932e5b11a28f5accdf166
Diffstat (limited to 'absl/strings/substitute_test.cc')
-rw-r--r--absl/strings/substitute_test.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/absl/strings/substitute_test.cc b/absl/strings/substitute_test.cc
index a6d7d7b0782d..7c9af6b22433 100644
--- a/absl/strings/substitute_test.cc
+++ b/absl/strings/substitute_test.cc
@@ -46,8 +46,14 @@ TEST(SubstituteTest, Substitute) {
   // Pointer.
   const int* int_p = reinterpret_cast<const int*>(0x12345);
   std::string str = absl::Substitute("$0", int_p);
-  EXPECT_EQ(absl::StrCat("0x", absl::Hex(reinterpret_cast<intptr_t>(int_p))),
-            str);
+  EXPECT_EQ(absl::StrCat("0x", absl::Hex(int_p)), str);
+
+  // Volatile Pointer.
+  // Like C++ streamed I/O, such pointers implicitly become bool
+  volatile int vol = 237;
+  volatile int *volatile volptr = &vol;
+  str = absl::Substitute("$0", volptr);
+  EXPECT_EQ("true", str);
 
   // null is special. StrCat prints 0x0. Substitute prints NULL.
   const uint64_t* null_p = nullptr;