forked from tarides/dune-release
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
91 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
open Alcotest | ||
|
||
let path = testable Fpath.pp Fpath.equal | ||
|
||
let error_msg = | ||
testable Bos_setup.R.pp_msg (fun (`Msg e1) (`Msg e2) -> String.equal e1 e2) | ||
|
||
let result_msg testable = result testable error_msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
open Alcotest | ||
open Bos_setup | ||
|
||
val path : Fpath.t testable | ||
|
||
val result_msg : 'a testable -> ('a, R.msg) result testable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
let is_backup_file () = | ||
let check ~input ~expected = | ||
let name = "Path.is_backup_file " ^ input in | ||
let actual = Dune_release.Stdext.Path.is_backup_file input in | ||
Alcotest.(check bool) name expected actual | ||
in | ||
check ~input:"" ~expected:false; | ||
check ~input:"fooooooooooooo" ~expected:false; | ||
check ~input:"fooooooooo#" ~expected:false; | ||
check ~input:"#fooooooooo#" ~expected:true; | ||
check ~input:"foooooooooooo~" ~expected:true | ||
|
||
let find_files () = | ||
let check ~name ~paths ~name_wo_ext ~expected = | ||
let paths = List.map Fpath.v paths in | ||
let expected = List.map Fpath.v expected in | ||
let actual = Dune_release.Stdext.Path.find_files ~name_wo_ext paths in | ||
let open Alcotest in | ||
let open Alcotest_ext in | ||
(check (list path)) name expected actual | ||
in | ||
check ~name:"Path.find_files empty" ~paths:[] ~name_wo_ext:"" ~expected:[]; | ||
check ~name:"Path.find_files does not contain" ~name_wo_ext:"foo" | ||
~paths:[ "aaa"; "bbb"; "#foo#"; "foo~"; ".foo.md.swp" ] | ||
~expected:[]; | ||
check ~name:"Path.find_files contains" ~name_wo_ext:"foo" | ||
~paths:[ "aaa"; "bbb"; "#foo#"; "foo~"; ".foo.md.swp"; "foo"; "foo.ml" ] | ||
~expected:[ "foo"; "foo.ml" ] | ||
|
||
let suite = | ||
( "Stdext", | ||
[ | ||
("Path.is_backup_file", `Quick, is_backup_file); | ||
("Path.find_files", `Quick, find_files); | ||
] ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
let () = | ||
Alcotest.run "dune-release" | ||
[ Test_github.suite; Test_pkg.suite; Test_tags.suite ] | ||
[ Test_github.suite; Test_pkg.suite; Test_stdext.suite; Test_tags.suite ] |