Make some unit tests use mock file output
authorTeemu Murtola <teemu.murtola@gmail.com>
Sun, 28 Jun 2015 19:21:52 +0000 (22:21 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 4 Jul 2015 10:22:39 +0000 (12:22 +0200)
commit67ebd75bb4680b07138b518978e8608a79cfbf80
tree6a5219d62a4140d3152bdb99384cfe94c8f9df54
parentd49f8ff3087d792a94c6fba7461a3a9d4c5b839d
Make some unit tests use mock file output

Introduce TextOutputStream interface that can be used instead of direct
file output.  Make unit tests for help output use an in-memory stream
instead of a real file using this mechanism.

TextWriter wraps the raw stream and provides more convenient
line-oriented writing capabilities (and provides a natural place to
implement more of the same, making them immediately available
independent of the stream used).

Most of the touched files only contain mechanical
  File -> TextWriter/TextOutputStream
and related documentation replacements.  The main non-trivial changes
are introduction of the streams and TextWriter in utility/, and
reorganization of the way the tests use TestOutputRedirector.

Further work follows to allow full removal of the old File class and to
extend the use of the streams.

Change-Id: I7700d0d8af5f44b304b940797a4834993e4738fb
36 files changed:
src/gromacs/commandline/cmdlinehelpcontext.cpp
src/gromacs/commandline/cmdlinehelpcontext.h
src/gromacs/commandline/cmdlinehelpmodule.cpp
src/gromacs/commandline/cmdlinehelpwriter.cpp
src/gromacs/commandline/shellcompletions.cpp
src/gromacs/commandline/shellcompletions.h
src/gromacs/commandline/tests/cmdlinehelpmodule.cpp
src/gromacs/commandline/tests/cmdlinehelpwriter.cpp
src/gromacs/commandline/tests/cmdlinemodulemanagertest.cpp
src/gromacs/commandline/tests/cmdlinemodulemanagertest.h
src/gromacs/onlinehelp/helptopic.cpp
src/gromacs/onlinehelp/helpwritercontext.cpp
src/gromacs/onlinehelp/helpwritercontext.h
src/gromacs/onlinehelp/tests/helpmanager.cpp
src/gromacs/selection/selectioncollection.cpp
src/gromacs/selection/selhelp.cpp
src/gromacs/utility.h
src/gromacs/utility/file.cpp
src/gromacs/utility/file.h
src/gromacs/utility/fileredirector.cpp
src/gromacs/utility/fileredirector.h
src/gromacs/utility/filestream.cpp [new file with mode: 0644]
src/gromacs/utility/filestream.h [new file with mode: 0644]
src/gromacs/utility/nodelete.h [new file with mode: 0644]
src/gromacs/utility/stringstream.cpp [new file with mode: 0644]
src/gromacs/utility/stringstream.h [new file with mode: 0644]
src/gromacs/utility/textstream.h [new file with mode: 0644]
src/gromacs/utility/textwriter.cpp [new file with mode: 0644]
src/gromacs/utility/textwriter.h [new file with mode: 0644]
src/testutils/cmdlinetest.cpp
src/testutils/stringtest.cpp
src/testutils/stringtest.h
src/testutils/testfileredirector.cpp
src/testutils/testfileredirector.h
src/testutils/testinit.cpp
src/testutils/testutils-doc.h