]> git.saurik.com Git - apt.git/blob - test/libapt/sourcelist_test.cc
add a testcase for support of various build-dependency types
[apt.git] / test / libapt / sourcelist_test.cc
1 #include <config.h>
2
3 #include <apt-pkg/sourcelist.h>
4 #include <apt-pkg/fileutl.h>
5
6 #include <string>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <unistd.h>
10
11 #include <gtest/gtest.h>
12
13 #include "file-helpers.h"
14
15 TEST(SourceListTest,ParseFileDeb822)
16 {
17 FileFd fd;
18 std::string tempfile;
19 createTemporaryFile("parsefiledeb822.XXXXXX.sources", fd, &tempfile,
20 "Types: deb\n"
21 "URIs: http://ftp.debian.org/debian\n"
22 "Suites: stable\n"
23 "Components: main\n"
24 "Description: short\n"
25 " long description that can be very long\n"
26 "\n"
27 "Types: deb\n"
28 "URIs: http://ftp.debian.org/debian\n"
29 "Suites: unstable\n"
30 "Components: main non-free\n");
31 fd.Close();
32
33 pkgSourceList sources;
34 EXPECT_EQ(true, sources.Read(tempfile));
35 EXPECT_EQ(2, sources.size());
36
37 if (tempfile.empty() == false)
38 unlink(tempfile.c_str());
39 }