11function SetUp ()
22 " project/
33 " +-- _git/
4+ " +-- a/
5+ " | +-- b/
6+ " | +- c.txt
47 " +-- foo foo/
58 " | +-- bar.txt
69 " +-- baz.txt
@@ -11,6 +14,8 @@ function SetUp()
1114 silent call mkdir (s: project_dir .' /_git' , ' p' )
1215 silent call mkdir (s: project_dir .' /foo foo' , ' p' )
1316 silent call writefile ([], s: project_dir .' /foo foo/bar.txt' )
17+ silent call mkdir (s: project_dir .' /a/b' , ' p' )
18+ silent call writefile ([], s: project_dir .' /a/b/c.txt' )
1419 silent call writefile ([], s: project_dir .' /baz.txt' )
1520 silent call writefile ([], s: project_dir .' /quux.z' )
1621
@@ -154,18 +159,24 @@ function Test_write_new_file()
154159 call assert_equal (expand (' %:p:h' ), getcwd ())
155160endfunction
156161
157- function Test_directory_is_ancestor ()
162+ function Test_root_is_directory ()
158163 let g: rooter_patterns = [' =foo foo/' ]
159164 execute ' edit' s: project_dir .' /foo\ foo/bar.txt'
160165 call assert_equal (s: project_dir .' /foo foo' , getcwd ())
161166endfunction
162167
163- function Test_directory_is_subdirectory ()
168+ function Test_root_has_ancestor ()
164169 let g: rooter_patterns = [' !^project' , ' *.txt' ]
165170 execute ' edit' s: project_dir .' /foo\ foo/bar.txt'
166171 call assert_equal (s: project_dir , getcwd ())
167172endfunction
168173
174+ function Test_root_has_parent ()
175+ let g: rooter_patterns = [' >a' ]
176+ execute ' edit' s: project_dir .' /a/b/c.txt'
177+ call assert_equal (s: project_dir .' /a/b' , getcwd ())
178+ endfunction
179+
169180function Test_glob ()
170181 let g: rooter_patterns = [' *.z' ]
171182 execute ' edit' s: project_dir .' /baz.txt'
0 commit comments