Add TFDTransport: a dead-simple wrapper around a file-descriptor.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665644 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/Makefile.am b/test/Makefile.am
index 5de2f1b..5490de8 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -27,6 +27,7 @@
Benchmark_LDADD = libtestgencpp.la
check_PROGRAMS = \
+ TFDTransportTest \
DebugProtoTest \
JSONProtoTest \
OptionalRequiredTest \
@@ -43,6 +44,15 @@
UnitTests_LDADD = libtestgencpp.la
#
+# TFDTransportTest
+#
+TFDTransportTest_SOURCES = \
+ TFDTransportTest.cpp
+
+TFDTransportTest_LDADD = \
+ $(top_srcdir)/lib/cpp/libthrift.la
+
+#
# DebugProtoTest
#
DebugProtoTest_SOURCES = \
diff --git a/test/TFDTransportTest.cpp b/test/TFDTransportTest.cpp
new file mode 100644
index 0000000..dfc2d27
--- /dev/null
+++ b/test/TFDTransportTest.cpp
@@ -0,0 +1,37 @@
+#include <cstdlib>
+#include <stdexcept>
+#include <Thrift.h>
+#include <transport/TFDTransport.h>
+using facebook::thrift::transport::TTransportException;
+using facebook::thrift::transport::TFDTransport;
+
+class DummyException : std::exception {
+};
+
+int main() {
+ {
+ TFDTransport t(256, TFDTransport::NO_CLOSE_ON_DESTROY);
+ }
+
+ try {
+ {
+ TFDTransport t(256, TFDTransport::CLOSE_ON_DESTROY);
+ }
+ std::abort();
+ } catch (TTransportException) {
+ }
+
+ try {
+ {
+ TFDTransport t(256, TFDTransport::CLOSE_ON_DESTROY);
+ throw DummyException();
+ }
+ std::abort();
+ } catch (TTransportException&) {
+ abort();
+ } catch (DummyException&) {
+ }
+
+ return 0;
+
+}