Improve path.mlt

This commit is contained in:
Jeremie Dimino 2018-04-24 13:37:53 +01:00
parent 6aa1b84fee
commit 85f434de2b
1 changed files with 10 additions and 11 deletions

View File

@ -1,6 +1,5 @@
(* -*- tuareg -*- *) (* -*- tuareg -*- *)
open Jbuilder;; open Stdune;;
open Import;;
let r = Path.(relative root);; let r = Path.(relative root);;
@ -8,44 +7,44 @@ let r = Path.(relative root);;
Path.(let p = relative root "foo" in descendant p ~of_:p) Path.(let p = relative root "foo" in descendant p ~of_:p)
[%%expect{| [%%expect{|
val r : string -> Jbuilder.Import.Path.t = <fun> val r : string -> Stdune.Path.t = <fun>
- : Jbuilder.Import.Path.t option = Some foo - : Stdune.Path.t option = Some foo
|}] |}]
(* different strings but same length *) (* different strings but same length *)
Path.(descendant (relative root "foo") ~of_:(relative root "bar")) Path.(descendant (relative root "foo") ~of_:(relative root "bar"))
[%%expect{| [%%expect{|
- : Jbuilder.Import.Path.t option = None - : Stdune.Path.t option = None
|}] |}]
Path.(descendant (r "foo") ~of_:(r "foo/")) Path.(descendant (r "foo") ~of_:(r "foo/"))
[%%expect{| [%%expect{|
- : Jbuilder.Import.Path.t option = Some foo - : Stdune.Path.t option = Some foo
|}] |}]
Path.(descendant (r "foo/") ~of_:(r "foo")) Path.(descendant (r "foo/") ~of_:(r "foo"))
[%%expect{| [%%expect{|
- : Jbuilder.Import.Path.t option = Some foo - : Stdune.Path.t option = Some foo
|}] |}]
Path.(descendant (r "foo/bar") ~of_:(r "foo")) Path.(descendant (r "foo/bar") ~of_:(r "foo"))
[%%expect{| [%%expect{|
- : Jbuilder.Import.Path.t option = Some bar - : Stdune.Path.t option = Some bar
|}] |}]
Path.(descendant Path.root ~of_:(r "foo")) Path.(descendant Path.root ~of_:(r "foo"))
[%%expect{| [%%expect{|
- : Jbuilder.Import.Path.t option = None - : Stdune.Path.t option = None
|}] |}]
Path.(descendant Path.root ~of_:Path.root) Path.(descendant Path.root ~of_:Path.root)
[%%expect{| [%%expect{|
- : Jbuilder.Import.Path.t option = Some . - : Stdune.Path.t option = Some .
|}] |}]
Path.(descendant (r "foo") ~of_:Path.root) Path.(descendant (r "foo") ~of_:Path.root)
[%%expect{| [%%expect{|
- : Jbuilder.Import.Path.t option = Some foo - : Stdune.Path.t option = Some foo
|}] |}]
Path.explode (Path.of_string "a/b/c"); Path.explode (Path.of_string "a/b/c");