add DEBUG switch and fix win build error

This commit is contained in:
zhangzifa
2019-02-21 11:20:28 +08:00
committed by TonyZZF
parent 6a5f788210
commit eb7ab33440
7 changed files with 65 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
#include "gtest/gtest.h"
#include "../../core/src/Utils.h"
#include <stdlib.h>
using namespace std;
using namespace AlibabaCloud;
@@ -60,4 +60,15 @@ namespace {
const std::string decoded = UrlDecode(encoded);
EXPECT_TRUE(decoded == url);
}
TEST(Utils, GetEnv) {
const std::string var1 = GetEnv("PATH");
EXPECT_FALSE(var1.empty());
const std::string var2 = GetEnv("NOT_EXISTS_PATH");
EXPECT_TRUE(var2.empty());
#ifndef _WIN32
setenv("SDK", "ttt", 1);
EXPECT_TRUE(GetEnv("SDK") == "ttt");
#endif
}
}