summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu>2010-06-10 18:13:53 -0700
committerDaniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu>2010-06-10 18:13:53 -0700
commit6480c9906a3b67f43742a6b54dd8b2c6af989f84 (patch)
tree8177e16b220bbc7b28beb51fece57140d3642284 /tests
parent08d498b6d917b18500c18538e78cc528dcc82f9e (diff)
downloadaptitude-6480c9906a3b67f43742a6b54dd8b2c6af989f84.tar.gz
Fix the teletype mock to only output set_last_line() when the last line has actually changed.
In particular, this means that outputting "\n" after a flush won't redundantly update the last line.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_teletype_mock.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_teletype_mock.cc b/tests/test_teletype_mock.cc
index 4c678abc..f28c1cfc 100644
--- a/tests/test_teletype_mock.cc
+++ b/tests/test_teletype_mock.cc
@@ -138,6 +138,28 @@ TEST_F(TeletypeTest, testOutputLine)
term->flush();
}
+TEST_F(TeletypeTest, NewlineAfterFlush)
+{
+ {
+ InSequence dummy;
+
+ EXPECT_CALL(*teletype, set_last_line(StrEq(L"abc")));
+ EXPECT_CALL(*teletype, newline());
+ }
+
+ term->output(L"abc");
+ term->output(L"\n");
+}
+
+TEST_F(TeletypeTest, SuppressDuplicateWrites)
+{
+ EXPECT_CALL(*teletype, set_last_line(StrEq(L"abc")));
+
+ term->output(L"abc");
+ term->move_to_beginning_of_line();
+ term->output(L"abc");
+}
+
// Imitates what the transient message does, to be sure that it will
// behave as expected if it outputs the right thing.
TEST_F(TeletypeTest, OverwriteABCWithA)