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
This commit is contained in:
parent
506fb4b56a
commit
4e2e6c5c00
7 changed files with 45 additions and 15 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue