aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/simple_parser_TEST.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/util/simple_parser_TEST.cc')
-rw-r--r--paludis/util/simple_parser_TEST.cc38
1 files changed, 14 insertions, 24 deletions
diff --git a/paludis/util/simple_parser_TEST.cc b/paludis/util/simple_parser_TEST.cc
index e6d285a41..8d913f8f2 100644
--- a/paludis/util/simple_parser_TEST.cc
+++ b/paludis/util/simple_parser_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 2009, 2011 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -18,33 +18,23 @@
*/
#include <paludis/util/simple_parser.hh>
-#include <test/test_runner.hh>
-#include <test/test_framework.hh>
-#include <test/test_concepts.hh>
+
+#include <gtest/gtest.h>
using namespace paludis;
-using namespace test;
-namespace test_cases
+TEST(SimpleParser, Works)
{
- struct TestSimpleParserIgnoreCase : TestCase
- {
- TestSimpleParserIgnoreCase() : TestCase("ignore case") { }
-
- void run()
- {
- std::string text("oneTWOthree"), one, two, three;
- SimpleParser parser(text);
- TEST_CHECK(parser.consume(simple_parser::exact("one") >> one));
- TEST_CHECK(parser.consume(simple_parser::exact_ignoring_case("two") >> two));
- TEST_CHECK(! parser.consume(simple_parser::exact("THREE") >> three));
- TEST_CHECK(parser.consume(simple_parser::exact_ignoring_case("THREE") >> three));
+ std::string text("oneTWOthree"), one, two, three;
+ SimpleParser parser(text);
+ ASSERT_TRUE(parser.consume(simple_parser::exact("one") >> one));
+ ASSERT_TRUE(parser.consume(simple_parser::exact_ignoring_case("two") >> two));
+ ASSERT_TRUE(! parser.consume(simple_parser::exact("THREE") >> three));
+ ASSERT_TRUE(parser.consume(simple_parser::exact_ignoring_case("THREE") >> three));
- TEST_CHECK(parser.eof());
- TEST_CHECK_EQUAL(one, "one");
- TEST_CHECK_EQUAL(two, "TWO");
- TEST_CHECK_EQUAL(three, "three");
- }
- } test_ignore_case;
+ ASSERT_TRUE(parser.eof());
+ EXPECT_EQ("one", one);
+ EXPECT_EQ("TWO", two);
+ EXPECT_EQ("three", three);
}