]> git.donarmstrong.com Git - lilypond.git/blob - flower/test-file-path.cc
Merge remote-tracking branch 'origin/translation'
[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 TEST (File_path, Find)
10 {
11   char const *extensions[] = {"ly", "", 0};
12   string file = "init";
13   char cwd[PATH_MAX];
14   if (!getcwd (cwd, PATH_MAX))
15     {
16       cerr << "Could not get current work directory\n";
17       exit (1);
18     }
19   string ly_dir = string (getenv ("top-src-dir")) + "/ly";
20   parse_path (string (1, PATHSEP) + ly_dir);
21   string file_name = find (file, extensions);
22   EQUAL (file_name.substr (file_name.rfind ('/')), "/init.ly");
23   file = "init.ly";
24   file_name = find (file, extensions);
25   EQUAL (file_name, ly_dir + "/init.ly");
26 }