diff options
Diffstat (limited to 'tests/textual.h')
-rw-r--r-- | tests/textual.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/textual.h b/tests/textual.h new file mode 100644 index 00000000..adf24c77 --- /dev/null +++ b/tests/textual.h @@ -0,0 +1,34 @@ +#ifndef __TESTTEXTUALJOURNAL_H +#define __TESTTEXTUALJOURNAL_H + +#include <cxxtest/TestSuite.h> + +#include <textual.h> +#include <config.h> + +using namespace std; +using namespace ledger; + +class TestTextualJournal : public CxxTest::TestSuite +{ +public: + void testEmptyFileIsTextualFile() + { + stringstream j(stringstream::in); + + j << "2005/10/15 Something" << endl; + j << " A $ 42" << endl; + j << " B" << endl; + + textual_parser_t textualParser; + TS_ASSERT(textualParser.test(j)); + TS_ASSERT(j.good()); + TS_ASSERT_EQUALS(0, j.tellg()); + + config_t config; + std::auto_ptr<journal_t> journal(new journal_t); + textualParser.parse(j, config, journal.get()); + } +}; + +#endif // __TESTTEXTUALJOURNAL_H |