/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <folly/File.h>
#include <folly/String.h>
-
-#include <gtest/gtest.h>
+#include <folly/portability/Fcntl.h>
+#include <folly/portability/GTest.h>
using namespace folly;
EXPECT_TRUE(false);
}
}
+
+TEST(File, HelperCtor) {
+ File::makeFile(StringPiece("/etc/hosts")).then([](File&& f) {
+ char buf = 'x';
+ EXPECT_NE(-1, f.fd());
+ EXPECT_EQ(1, ::read(f.fd(), &buf, 1));
+ f.close();
+ EXPECT_EQ(-1, f.fd());
+ });
+}