本文整理汇总了C++中FileHelper::CreateTempFile方法的典型用法代码示例。如果您正苦于以下问题:C++ FileHelper::CreateTempFile方法的具体用法?C++ FileHelper::CreateTempFile怎么用?C++ FileHelper::CreateTempFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHelper
的用法示例。
在下文中一共展示了FileHelper::CreateTempFile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(FileTest, IsAbsolute) {
static const string kFileName = this->test_info_->name();
FileHelper helper;
const string path = helper.CreateTempFile(kFileName, "Hello World");
EXPECT_TRUE(File::IsAbsolutePath(path));
EXPECT_FALSE(File::IsAbsolutePath(kFileName));
}
示例2: file
TEST(FileTest, LastWriteTime_NotOpen) {
static const string kHelloWorld = "Hello World";
FileHelper helper;
time_t now = time(nullptr);
string path = helper.CreateTempFile(this->test_info_->name(), kHelloWorld);
File file(path);
ASSERT_LE(now, file.last_write_time());
}
示例3: file
TEST(FileTest, IsOpen_Open) {
static const string kHelloWorld = "Hello World";
FileHelper helper;
string path = helper.CreateTempFile(this->test_info_->name(), kHelloWorld);
File file(path);
ASSERT_TRUE(file.Open(File::modeBinary | File::modeReadOnly));
EXPECT_TRUE(file.IsOpen());
EXPECT_TRUE((bool) file);
}
示例4:
TEST(FileTest, RealPath_Same) {
static const string kFileName = this->test_info_->name();
FileHelper helper;
const string path = helper.CreateTempFile(kFileName, "Hello World");
string realpath;
ASSERT_TRUE(File::RealPath(path, &realpath));
EXPECT_EQ(path, realpath);
}
示例5: relative
TEST(FileTest, MakeAbsolutePath_AlreadyAbsolute) {
static const string kFileName = this->test_info_->name();
FileHelper helper;
const string path = helper.CreateTempFile(kFileName, "Hello World");
string relative(path); // Note: relative == absolute path (path)
File::MakeAbsolutePath(helper.TempDir(), &relative);
EXPECT_EQ(path, relative);
}
示例6: StrCat
TEST(FileTest, ExistsWildCard_Extension) {
FileHelper helper;
const string path = helper.CreateTempFile("msg00000.001", "msg00000.001");
ASSERT_TRUE(File::Exists(path));
string wildcard_path = StrCat(helper.TempDir(), File::pathSeparatorString, "msg*.001");
ASSERT_TRUE(File::ExistsWildcard(wildcard_path)) << path << "; w: " << wildcard_path;
wildcard_path = StrCat(helper.TempDir(), File::pathSeparatorString, "msg*.??1");
ASSERT_TRUE(File::ExistsWildcard(wildcard_path)) << path << "; w: " << wildcard_path;
}
示例7: line
TEST(PPPConfigTest, NodeConfig) {
FileHelper files;
files.Mkdir("network");
const string line("@2 [email protected]");
files.CreateTempFile("network/address.net", line);
const string network_dir = files.DirName("network");
PPPConfig config(1, "mybbs", network_dir);
const PPPNodeConfig* node_config = config.node_config_for(2);
ASSERT_TRUE(node_config != nullptr);
EXPECT_EQ("[email protected]", node_config->email_address);
}
示例8: line
TEST_F(CalloutTest, NodeConfig) {
FileHelper files;
files.Mkdir("network");
const string line("@1 & \"foo\"");
files.CreateTempFile("network/callout.net", line);
const string network_dir = files.DirName("network");
Callout callout(network_dir);
const net_call_out_rec* con = callout.node_config_for(1);
ASSERT_TRUE(con != nullptr);
EXPECT_EQ(options_sendback, con->options);
EXPECT_STREQ("foo", con->password);
}