summaryrefslogtreecommitdiff
path: root/tests/stdlib_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-11-08 21:53:50 -0800
committerElliott Hughes <enh@google.com>2017-11-08 21:53:50 -0800
commit728cde5be92f65a70f1b4c5afc4494ab169ee95d (patch)
treea37bc96aba94b0bf2da3b81e711f4547fd8e14b9 /tests/stdlib_test.cpp
parent265b1ab966cd8ffba430c0ab65f35752757b78ec (diff)
Add trivial ttyname(3) test.
Bug: N/A Test: ran tests Change-Id: Id5bf51a9c50db0fdbc9df0225165e87e698d0c83
Diffstat (limited to 'tests/stdlib_test.cpp')
-rw-r--r--tests/stdlib_test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/stdlib_test.cpp b/tests/stdlib_test.cpp
index 27495d88f..0c403807d 100644
--- a/tests/stdlib_test.cpp
+++ b/tests/stdlib_test.cpp
@@ -508,6 +508,16 @@ TEST(stdlib, ptsname_r_ERANGE) {
close(fd);
}
+TEST(stdlib, ttyname) {
+ int fd = getpt();
+ ASSERT_NE(-1, fd);
+
+ // ttyname returns "/dev/ptmx" for a pty.
+ ASSERT_STREQ("/dev/ptmx", ttyname(fd));
+
+ close(fd);
+}
+
TEST(stdlib, ttyname_r) {
int fd = getpt();
ASSERT_NE(-1, fd);