futures/Timekeeper.h \
futures/Try-inl.h \
futures/Try.h \
- futures/Unit.h \
futures/detail/Core.h \
futures/detail/FSM.h \
futures/detail/Types.h \
Traits.h \
Unicode.h \
Function.h \
+ Unit.h \
Uri.h \
Uri-inl.h \
Varint.h \
--- /dev/null
+/*
+ * Copyright 2016 Facebook, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <type_traits>
+
+namespace folly {
+
+/// In functional programming, the degenerate case is often called "unit". In
+/// C++, "void" is often the best analogue, however because of the syntactic
+/// special-casing required for void it is a liability for template
+/// metaprogramming. So, instead of e.g. Future<void>, we have Future<Unit>.
+/// You can ignore the actual value, and we port some of the syntactic
+/// niceties like setValue() instead of setValue(Unit{}).
+struct Unit {
+ template <typename T>
+ using Lift = std::conditional<std::is_same<T, void>::value, Unit, T>;
+ template <typename T>
+ using Drop = std::conditional<std::is_same<T, Unit>::value, void, T>;
+
+ bool operator==(const Unit& /*other*/) const { return true; }
+ bool operator!=(const Unit& /*other*/) const { return false; }
+};
+
+constexpr Unit unit {};
+
+}
#pragma once
#include <folly/futures/detail/Types.h>
-#include <folly/futures/Unit.h>
+#include <folly/Unit.h>
namespace folly {
#include <folly/Memory.h>
#include <folly/Portability.h>
#include <folly/futures/FutureException.h>
-#include <folly/futures/Unit.h>
+#include <folly/Unit.h>
namespace folly {
+++ /dev/null
-/*
- * Copyright 2016 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <type_traits>
-
-namespace folly {
-
-/// In functional programming, the degenerate case is often called "unit". In
-/// C++, "void" is often the best analogue, however because of the syntactic
-/// special-casing required for void it is a liability for template
-/// metaprogramming. So, instead of e.g. Future<void>, we have Future<Unit>.
-/// You can ignore the actual value, and we port some of the syntactic
-/// niceties like setValue() instead of setValue(Unit{}).
-struct Unit {
- template <typename T>
- using Lift = std::conditional<std::is_same<T, void>::value, Unit, T>;
- template <typename T>
- using Drop = std::conditional<std::is_same<T, Unit>::value, void, T>;
-
- bool operator==(const Unit& /*other*/) const { return true; }
- bool operator!=(const Unit& /*other*/) const { return false; }
-};
-
-constexpr Unit unit {};
-
-}
#include <gtest/gtest.h>
#include <folly/futures/Future.h>
-#include <folly/futures/Unit.h>
+#include <folly/Unit.h>
#include <folly/Memory.h>
#include <folly/Executor.h>
#include <folly/dynamic.h>
+++ /dev/null
-/*
- * Copyright 2016 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-
-#include <folly/futures/Unit.h>
-
-using namespace folly;
-
-TEST(Unit, operatorEq) {
- EXPECT_TRUE(Unit{} == Unit{});
-}
-
-TEST(Unit, operatorNe) {
- EXPECT_FALSE(Unit{} != Unit{});
-}
-
-TEST(Unit, liftInt) {
- using lifted = Unit::Lift<int>;
- using actual = std::is_same<int, lifted::type>;
- EXPECT_TRUE(actual::value);
-}
-
-TEST(Unit, liftUnit) {
- using lifted = Unit::Lift<Unit>;
- using actual = std::is_same<Unit, lifted::type>;
- EXPECT_TRUE(actual::value);
-}
-
-TEST(Unit, liftVoid) {
- using lifted = Unit::Lift<void>;
- using actual = std::is_same<Unit, lifted::type>;
- EXPECT_TRUE(actual::value);
-}
-
-TEST(Unit, dropInt) {
- using dropped = Unit::Drop<int>;
- using actual = std::is_same<int, dropped::type>;
- EXPECT_TRUE(actual::value);
-}
-
-TEST(Unit, dropUnit) {
- using dropped = Unit::Drop<Unit>;
- using actual = std::is_same<void, dropped::type>;
- EXPECT_TRUE(actual::value);
-}
-
-TEST(Unit, dropVoid) {
- using dropped = Unit::Drop<void>;
- using actual = std::is_same<void, dropped::type>;
- EXPECT_TRUE(actual::value);
-}
indestructible_test_LDADD = libfollytestmain.la
TESTS += indestructible_test
+unit_test_SOURCES = UnitTest.cpp
+unit_test_LDADD = libfollytestmain.la
+TESTS += unit_test
futures_test_SOURCES = \
../futures/test/CollectTest.cpp \
../futures/test/TimekeeperTest.cpp \
../futures/test/TimesTest.cpp \
../futures/test/TryTest.cpp \
- ../futures/test/UnitTest.cpp \
../futures/test/UnwrapTest.cpp \
../futures/test/ViaTest.cpp \
../futures/test/WaitTest.cpp \
--- /dev/null
+/*
+ * Copyright 2016 Facebook, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include <folly/Unit.h>
+
+using namespace folly;
+
+TEST(Unit, operatorEq) {
+ EXPECT_TRUE(Unit{} == Unit{});
+}
+
+TEST(Unit, operatorNe) {
+ EXPECT_FALSE(Unit{} != Unit{});
+}
+
+TEST(Unit, liftInt) {
+ using lifted = Unit::Lift<int>;
+ using actual = std::is_same<int, lifted::type>;
+ EXPECT_TRUE(actual::value);
+}
+
+TEST(Unit, liftUnit) {
+ using lifted = Unit::Lift<Unit>;
+ using actual = std::is_same<Unit, lifted::type>;
+ EXPECT_TRUE(actual::value);
+}
+
+TEST(Unit, liftVoid) {
+ using lifted = Unit::Lift<void>;
+ using actual = std::is_same<Unit, lifted::type>;
+ EXPECT_TRUE(actual::value);
+}
+
+TEST(Unit, dropInt) {
+ using dropped = Unit::Drop<int>;
+ using actual = std::is_same<int, dropped::type>;
+ EXPECT_TRUE(actual::value);
+}
+
+TEST(Unit, dropUnit) {
+ using dropped = Unit::Drop<Unit>;
+ using actual = std::is_same<void, dropped::type>;
+ EXPECT_TRUE(actual::value);
+}
+
+TEST(Unit, dropVoid) {
+ using dropped = Unit::Drop<void>;
+ using actual = std::is_same<void, dropped::type>;
+ EXPECT_TRUE(actual::value);
+}