]> git.saurik.com Git - apt.git/blame - test/libapt/sourcelist_test.cc
remove Dir:: scope limit of RootDir in the documentation
[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 15TEST(SourceListTest,ParseFileDeb822)
caeb19b7 16{
f00832cc 17 FileFd fd;
3d8232bf 18 std::string tempfile;
81460e32 19 createTemporaryFile("parsefiledeb822.XXXXXX.sources", fd, &tempfile,
7f316a3f 20 "Types: deb\n"
75c10df1 21 "URIs: http://ftp.debian.org/debian\n"
6c069a22 22 "Suites: stable\n"
81460e32 23 "Components: main\n"
e67b9a23
MV
24 "Description: short\n"
25 " long description that can be very long\n"
caeb19b7 26 "\n"
7f316a3f 27 "Types: deb\n"
75c10df1 28 "URIs: http://ftp.debian.org/debian\n"
7f316a3f 29 "Suites: unstable\n"
81460e32 30 "Components: main non-free\n");
f00832cc 31 fd.Close();
caeb19b7 32
81460e32
DK
33 pkgSourceList sources;
34 EXPECT_EQ(true, sources.Read(tempfile));
f00832cc 35 EXPECT_EQ(2, sources.size());
caeb19b7 36
3d8232bf
DK
37 if (tempfile.empty() == false)
38 unlink(tempfile.c_str());
caeb19b7 39}