aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-20 19:15:59 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-20 19:15:59 +0000
commit3c6d7ced8e8b31dd917c940e12b0ef11dd2ccaf4 (patch)
tree11c0d95416dc6cb3f4b8e37a80ff9e03594d6868
parent00bb119b64c3be3113b2b4274653a2e9261f3313 (diff)
downloadpaludis-3c6d7ced8e8b31dd917c940e12b0ef11dd2ccaf4.tar.gz
paludis-3c6d7ced8e8b31dd917c940e12b0ef11dd2ccaf4.tar.xz
gtest more
-rw-r--r--paludis/util/files.m42
-rw-r--r--paludis/util/is_file_with_extension_TEST.cc73
2 files changed, 24 insertions, 51 deletions
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 87c75ef..443bf7a 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -45,7 +45,7 @@ add(`graph', `hh', `cc', `fwd', `impl', `test')
add(`hashes', `hh', `cc', `test')
add(`iterator_funcs', `hh', `test')
add(`indirect_iterator', `hh', `fwd', `impl', `test')
-add(`is_file_with_extension', `hh', `cc', `se', `test', `testscript')
+add(`is_file_with_extension', `hh', `cc', `se', `gtest', `testscript')
add(`join', `hh', `gtest')
add(`log', `hh', `cc', `se', `gtest')
add(`make_named_values', `hh', `cc')
diff --git a/paludis/util/is_file_with_extension_TEST.cc b/paludis/util/is_file_with_extension_TEST.cc
index a5e36af..16b000a 100644
--- a/paludis/util/is_file_with_extension_TEST.cc
+++ b/paludis/util/is_file_with_extension_TEST.cc
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2006 Mark Loeser
+ * Copyright (c) 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
@@ -17,71 +18,43 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <algorithm>
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/fs_path.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/options.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
+
+#include <algorithm>
#include <vector>
-/** \file
- * Test cases for IsFileWithExtension.
- *
- */
+#include <gtest/gtest.h>
using namespace paludis;
-using namespace test;
-namespace test_cases
+TEST(IsFileWithExtension, Works)
{
- /**
- * \test Test IsFileWithExtension.
- *
- */
- struct IsFileWithExtensionTest : TestCase
- {
- IsFileWithExtensionTest() : TestCase("is file with extension") { }
-
- void run()
- {
- FSPath c("teh.foo");
- FSPath d("is_file_with_extension_TEST_file.goat");
+ FSPath c("teh.foo");
+ FSPath d("is_file_with_extension_TEST_file.goat");
- TEST_CHECK(d.stat().exists());
+ ASSERT_TRUE(d.stat().exists());
- TEST_CHECK(! is_file_with_extension(c, "foo", { }));
- TEST_CHECK(! is_file_with_extension(d, "foo", { }));
- TEST_CHECK(! is_file_with_extension(c, "goat", { }));
- TEST_CHECK(is_file_with_extension(d, "goat", { }));
+ EXPECT_TRUE(! is_file_with_extension(c, "foo", { }));
+ EXPECT_TRUE(! is_file_with_extension(d, "foo", { }));
+ EXPECT_TRUE(! is_file_with_extension(c, "goat", { }));
+ EXPECT_TRUE(is_file_with_extension(d, "goat", { }));
- }
- } test_is_file_with_extension;
-
- /**
- * \test Test IsFileWithExtension with a prefix.
- *
- */
- struct IsFileWithExtensionPrefixTest : TestCase
- {
- IsFileWithExtensionPrefixTest() : TestCase("is file with extension (with prefix)") { }
-
- void run()
- {
- FSPath d("teh.foo");
- FSPath e("is_file_with_extension_TEST_file.goat");
-
- TEST_CHECK(e.stat().exists());
+}
- TEST_CHECK(! is_file_with_prefix_extension(d, "teh", "foo", { }));
- TEST_CHECK(! is_file_with_prefix_extension(e, "teh", "foo", { }));
- TEST_CHECK(! is_file_with_prefix_extension(d, "is", "goat", { }));
- TEST_CHECK(is_file_with_prefix_extension(e, "is", "goat", { }));
- TEST_CHECK(! is_file_with_prefix_extension(e, "with", "goat", { }));
- }
- } test_is_file_with_extension_prefix;
+TEST(IsFileWithPrefixExtension, Works)
+{
+ FSPath d("teh.foo");
+ FSPath e("is_file_with_extension_TEST_file.goat");
+ ASSERT_TRUE(e.stat().exists());
+ EXPECT_TRUE(! is_file_with_prefix_extension(d, "teh", "foo", { }));
+ EXPECT_TRUE(! is_file_with_prefix_extension(e, "teh", "foo", { }));
+ EXPECT_TRUE(! is_file_with_prefix_extension(d, "is", "goat", { }));
+ EXPECT_TRUE(is_file_with_prefix_extension(e, "is", "goat", { }));
+ EXPECT_TRUE(! is_file_with_prefix_extension(e, "with", "goat", { }));
}