]> git.saurik.com Git - apt.git/blame - test/libapt/sourcelist_test.cc
adapt to the new CacheSetHelper API
[apt.git] / test / libapt / sourcelist_test.cc
CommitLineData
453b82a3
DK
1#include <config.h>
2
caeb19b7 3#include <apt-pkg/sourcelist.h>
453b82a3 4#include <apt-pkg/fileutl.h>
caeb19b7 5
453b82a3 6#include <string>
caeb19b7
MV
7#include <stdlib.h>
8#include <string.h>
9#include <unistd.h>
10
f00832cc 11#include <gtest/gtest.h>
453b82a3 12
f00832cc 13#include "file-helpers.h"
caeb19b7 14
f00832cc
DK
15class SourceList : public pkgSourceList {
16 public:
17 using pkgSourceList::ParseFileDeb822;
18};
caeb19b7 19
f00832cc 20TEST(SourceListTest,ParseFileDeb822)
caeb19b7 21{
f00832cc
DK
22 FileFd fd;
23 char * tempfile;
24 createTemporaryFile("parsefiledeb822", fd, &tempfile,
7f316a3f 25 "Types: deb\n"
75c10df1 26 "URIs: http://ftp.debian.org/debian\n"
6c069a22
MV
27 "Suites: stable\n"
28 "Sections: main\n"
e67b9a23
MV
29 "Description: short\n"
30 " long description that can be very long\n"
caeb19b7 31 "\n"
7f316a3f 32 "Types: deb\n"
75c10df1 33 "URIs: http://ftp.debian.org/debian\n"
7f316a3f 34 "Suites: unstable\n"
f00832cc
DK
35 "Sections: main non-free\n");
36 fd.Close();
caeb19b7 37
f00832cc
DK
38 SourceList sources;
39 EXPECT_EQ(2, sources.ParseFileDeb822(tempfile));
40 EXPECT_EQ(2, sources.size());
caeb19b7 41
f00832cc 42 unlink(tempfile);
caeb19b7 43}