Improve tests of Path.descendant

It should test cases where the paths are build dirs
This commit is contained in:
Rudi Grinberg 2018-05-12 12:50:43 +07:00
parent a80a6f18b2
commit 33a99884e4
1 changed files with 30 additions and 0 deletions

View File

@ -115,6 +115,36 @@ Path.(descendant (r "foo") ~of_:Path.root)
- : Stdune.Path.t option = Some foo
|}]
Path.(descendant (relative build_dir "foo") ~of_:root)
[%%expect{|
- : Stdune.Path.t option = Some _build/foo
|}]
Path.(descendant (relative build_dir "foo") ~of_:(absolute "/foo/bar"))
[%%expect{|
- : Stdune.Path.t option = None
|}]
Path.(descendant (relative build_dir "foo/bar") ~of_:build_dir)
[%%expect{|
- : Stdune.Path.t option = Some foo/bar
|}]
Path.(descendant (relative build_dir "foo/bar") ~of_:(relative build_dir "foo"))
[%%expect{|
- : Stdune.Path.t option = Some bar
|}]
Path.(descendant (relative build_dir "foo/bar") ~of_:(relative build_dir "foo"))
[%%expect{|
- : Stdune.Path.t option = Some bar
|}]
Path.(descendant (absolute "/foo/bar") ~of_:(absolute "/foo"))
[%%expect{|
- : Stdune.Path.t option = None
|}]
Path.explode (Path.of_string "a/b/c");
[%%expect{|
- : string list option = Some ["a"; "b"; "c"]