2222#include " test.h"
2323#include " util.h"
2424
25- using namespace std ;
26-
2725namespace {
2826
29- string GetCurDir () {
27+ std:: string GetCurDir () {
3028 char buf[_MAX_PATH];
3129 _getcwd (buf, sizeof (buf));
32- vector<StringPiece> parts = SplitStringPiece (buf, ' \\ ' );
30+ std:: vector<StringPiece> parts = SplitStringPiece (buf, ' \\ ' );
3331 return parts[parts.size () - 1 ].AsString ();
3432}
3533
36- string NormalizeAndCheckNoError (const string& input) {
37- string result, err;
34+ std:: string NormalizeAndCheckNoError (const std:: string& input) {
35+ std:: string result, err;
3836 IncludesNormalize normalizer (" ." );
3937 EXPECT_TRUE (normalizer.Normalize (input, &result, &err));
4038 EXPECT_EQ (" " , err);
4139 return result;
4240}
4341
44- string NormalizeRelativeAndCheckNoError (const string& input,
45- const string& relative_to) {
46- string result, err;
42+ std:: string NormalizeRelativeAndCheckNoError (const std:: string& input,
43+ const std:: string& relative_to) {
44+ std:: string result, err;
4745 IncludesNormalize normalizer (relative_to);
4846 EXPECT_TRUE (normalizer.Normalize (input, &result, &err));
4947 EXPECT_EQ (" " , err);
@@ -60,15 +58,15 @@ TEST(IncludesNormalize, Simple) {
6058}
6159
6260TEST (IncludesNormalize, WithRelative) {
63- string err;
64- string currentdir = GetCurDir ();
61+ std:: string err;
62+ std:: string currentdir = GetCurDir ();
6563 EXPECT_EQ (" c" , NormalizeRelativeAndCheckNoError (" a/b/c" , " a/b" ));
6664 EXPECT_EQ (" a" ,
6765 NormalizeAndCheckNoError (IncludesNormalize::AbsPath (" a" , &err)));
6866 EXPECT_EQ (" " , err);
69- EXPECT_EQ (string (" ../" ) + currentdir + string (" /a" ),
67+ EXPECT_EQ (std:: string (" ../" ) + currentdir + std:: string (" /a" ),
7068 NormalizeRelativeAndCheckNoError (" a" , " ../b" ));
71- EXPECT_EQ (string (" ../" ) + currentdir + string (" /a/b" ),
69+ EXPECT_EQ (std:: string (" ../" ) + currentdir + std:: string (" /a/b" ),
7270 NormalizeRelativeAndCheckNoError (" a/b" , " ../c" ));
7371 EXPECT_EQ (" ../../a" , NormalizeRelativeAndCheckNoError (" a" , " b/c" ));
7472 EXPECT_EQ (" ." , NormalizeRelativeAndCheckNoError (" a" , " a" ));
@@ -107,7 +105,7 @@ TEST(IncludesNormalize, LongInvalidPath) {
107105 " is usually a configuration error. Compilation will continue using /Z7 "
108106 " instead of /Zi, but expect a similar error when you link your program." ;
109107 // Too long, won't be canonicalized. Ensure doesn't crash.
110- string result, err;
108+ std:: string result, err;
111109 IncludesNormalize normalizer (" ." );
112110 EXPECT_FALSE (
113111 normalizer.Normalize (kLongInputString , &result, &err));
@@ -138,15 +136,15 @@ TEST(IncludesNormalize, LongInvalidPath) {
138136 // This is a relatively safe cast as we can expect that _MAX_PATH will never be negative
139137 EXPECT_EQ (strlen (kExactlyMaxPath ), static_cast <size_t >(_MAX_PATH));
140138
141- string forward_slashes (kExactlyMaxPath );
139+ std:: string forward_slashes (kExactlyMaxPath );
142140 replace (forward_slashes.begin (), forward_slashes.end (), ' \\ ' , ' /' );
143141 // Make sure a path that's exactly _MAX_PATH long is canonicalized.
144142 EXPECT_EQ (forward_slashes.substr (cwd_len + 1 ),
145143 NormalizeAndCheckNoError (kExactlyMaxPath ));
146144}
147145
148146TEST (IncludesNormalize, ShortRelativeButTooLongAbsolutePath) {
149- string result, err;
147+ std:: string result, err;
150148 IncludesNormalize normalizer (" ." );
151149 // A short path should work
152150 EXPECT_TRUE (normalizer.Normalize (" a" , &result, &err));
@@ -166,5 +164,5 @@ TEST(IncludesNormalize, ShortRelativeButTooLongAbsolutePath) {
166164
167165 // Make sure a path that's exactly _MAX_PATH long fails with a proper error.
168166 EXPECT_FALSE (normalizer.Normalize (kExactlyMaxPath , &result, &err));
169- EXPECT_TRUE (err.find (" GetFullPathName" ) != string::npos);
167+ EXPECT_TRUE (err.find (" GetFullPathName" ) != std:: string::npos);
170168}
0 commit comments