File: TestSearchPath.cc

package info (click to toggle)
j4-dmenu-desktop 2.16-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 312 kB
  • sloc: cpp: 1,145; makefile: 6; sh: 6
file content (24 lines) | stat: -rw-r--r-- 692 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

#include <stdlib.h>
#include <list>
#include <string>
#include <vector>

#include "SearchPath.hh"
#include "catch.hpp"

static const std::string test_files = TEST_FILES;

TEST_CASE("SearchPath/XDG_DATA_DIRS", "Check SearchPath honors XDG_DATA_DIRS")
{
    unsetenv("XDG_DATA_HOME");
    setenv("HOME", "/home/testuser", 1);
    setenv("XDG_DATA_DIRS", (test_files + "usr/share/:" + test_files + "usr/local/share/").c_str(), 1);

    SearchPath sp;
    std::vector<std::string> result(sp.begin(), sp.end());
    
    REQUIRE( result.size() == 2 );
    REQUIRE( result[0] == test_files + "usr/share/applications/" );
    REQUIRE( result[1] == test_files + "usr/local/share/applications/" );
}