]> git.donarmstrong.com Git - lilypond.git/blob - flower/test-file-path.cc
Issue 4550 (1/2) Avoid "using namespace std;" in included files
[lilypond.git] / flower / test-file-path.cc
1 #include "file-path.hh"
2
3 #include <limits.h>
4 #include <unistd.h>
5
6 #include "yaffut.hh"
7 #include "config.hh"
8
9 using std::string;
10
11 TEST (File_path, Find)
12 {
13   char const *extensions[] = {"ly", "", 0};
14   string file = "init";
15   char cwd[PATH_MAX];
16   if (!getcwd (cwd, PATH_MAX))
17     {
18       cerr << "Could not get current work directory\n";
19       exit (1);
20     }
21   string ly_dir = string (getenv ("top-src-dir")) + "/ly";
22   parse_path (string (1, PATHSEP) + ly_dir);
23   string file_name = find (file, extensions);
24   EQUAL (file_name.substr (file_name.rfind ('/')), "/init.ly");
25   file = "init.ly";
26   file_name = find (file, extensions);
27   EQUAL (file_name, ly_dir + "/init.ly");
28 }