aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/buffer.cpp2
-rw-r--r--src/unit/buffer.unit27
2 files changed, 28 insertions, 1 deletions
diff --git a/src/buffer.cpp b/src/buffer.cpp
index fa27116..234dc92 100644
--- a/src/buffer.cpp
+++ b/src/buffer.cpp
@@ -153,6 +153,6 @@ void Bu::Buffer::flush()
153 153
154bool Bu::Buffer::isEos() 154bool Bu::Buffer::isEos()
155{ 155{
156 return iReadPos == (iReadBufFill-1) && rNext.isEos(); 156 return (iReadPos >= (iReadBufFill-1)) && (rNext.isEos());
157} 157}
158 158
diff --git a/src/unit/buffer.unit b/src/unit/buffer.unit
new file mode 100644
index 0000000..8ed1ec5
--- /dev/null
+++ b/src/unit/buffer.unit
@@ -0,0 +1,27 @@
1// vim: syntax=cpp
2/*
3 * Copyright (C) 2007-2010 Xagasoft, All rights reserved.
4 *
5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE.
7 */
8
9#include "bu/file.h"
10#include "bu/membuf.h"
11#include "bu/buffer.h"
12
13suite Buffer
14{
15 test emptyFile
16 {
17 Bu::FString sTmp("empty-XXXXXX");
18 Bu::File fEmpty = tempFile(sTmp);
19 Bu::Buffer buf( fEmpty );
20
21 unitTest( buf.isEos() == false );
22 Bu::FString sLine = buf.readLine();
23 unitTest( sLine == "" );
24 unitTest( fEmpty.isEos() == true );
25 unitTest( buf.isEos() == true );
26 }
27}