From 6778ed99fe197a05bd109eab1ec047ddcba07ca4 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 21 Jun 2010 14:56:21 +0000 Subject: Fixed a bug in Bu::Buffer that resulted from a false negative on isEos if the underlying stream was empty. --- src/unit/buffer.unit | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/unit/buffer.unit (limited to 'src/unit/buffer.unit') 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 @@ +// vim: syntax=cpp +/* + * Copyright (C) 2007-2010 Xagasoft, All rights reserved. + * + * This file is part of the libbu++ library and is released under the + * terms of the license contained in the file LICENSE. + */ + +#include "bu/file.h" +#include "bu/membuf.h" +#include "bu/buffer.h" + +suite Buffer +{ + test emptyFile + { + Bu::FString sTmp("empty-XXXXXX"); + Bu::File fEmpty = tempFile(sTmp); + Bu::Buffer buf( fEmpty ); + + unitTest( buf.isEos() == false ); + Bu::FString sLine = buf.readLine(); + unitTest( sLine == "" ); + unitTest( fEmpty.isEos() == true ); + unitTest( buf.isEos() == true ); + } +} -- cgit v1.2.3