diff options
author | Michael Vogt <mvo@ubuntu.com> | 2014-07-08 15:11:14 +0200 |
---|---|---|
committer | Michael Vogt <mvo@ubuntu.com> | 2014-07-08 15:11:14 +0200 |
commit | a5bb5e1e747ceb7b5a9defb6b1a8d9282a6e0957 (patch) | |
tree | 4650dafd968a216b8ccdcd04d9a663fc9a312932 /test/libapt | |
parent | 2830b8436ac8a6f2f3dac4ce2cd030c24eebce04 (diff) |
Only allow "apt-get build-dep path" when path starts with ./ or /
This avoid the subtle problem that someone might have a directory
with the same package name as the build-depends he/she is trying
to fetch. Also print a note that the specific file/dir is used.
Diffstat (limited to 'test/libapt')
-rw-r--r-- | test/libapt/strutil_test.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index e9b778c6b..1c2f0abac 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -70,6 +70,15 @@ TEST(StrUtilTest,EndsWith) EXPECT_FALSE(Endswith("abcd", "x")); EXPECT_FALSE(Endswith("abcd", "abcndefg")); } +TEST(StrUtilTest,StartWith) +{ + using APT::String::Startswith; + EXPECT_TRUE(Startswith("abcd", "a")); + EXPECT_TRUE(Startswith("abcd", "ab")); + EXPECT_TRUE(Startswith("abcd", "abcd")); + EXPECT_FALSE(Startswith("abcd", "x")); + EXPECT_FALSE(Startswith("abcd", "abcndefg")); +} TEST(StrUtilTest,SubstVar) { EXPECT_EQ("", SubstVar("", "fails", "passes")); |