sourcelist_test.cc 892 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <config.h>
  2. #include <apt-pkg/sourcelist.h>
  3. #include <apt-pkg/fileutl.h>
  4. #include <string>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include <unistd.h>
  8. #include <gtest/gtest.h>
  9. #include "file-helpers.h"
  10. TEST(SourceListTest,ParseFileDeb822)
  11. {
  12. FileFd fd;
  13. std::string tempfile;
  14. createTemporaryFile("parsefiledeb822.XXXXXX.sources", fd, &tempfile,
  15. "Types: deb\n"
  16. "URIs: http://ftp.debian.org/debian\n"
  17. "Suites: stable\n"
  18. "Components: main\n"
  19. "Description: short\n"
  20. " long description that can be very long\n"
  21. "\n"
  22. "Types: deb\n"
  23. "URIs: http://ftp.debian.org/debian\n"
  24. "Suites: unstable\n"
  25. "Components: main non-free\n");
  26. fd.Close();
  27. pkgSourceList sources;
  28. EXPECT_EQ(true, sources.Read(tempfile));
  29. EXPECT_EQ(2, sources.size());
  30. if (tempfile.empty() == false)
  31. unlink(tempfile.c_str());
  32. }