Skip to content

Commit

Permalink
Get rid of inline tests.
Browse files Browse the repository at this point in the history
Cases already covered up by external tests.
Allows us to get rid of a runtime dep, see ocaml/dune#897
  • Loading branch information
etaque committed Jun 3, 2019
1 parent 000855b commit e4228a9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
4 changes: 1 addition & 3 deletions lib/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
(library
(name semver)
(public_name semver2)
(libraries angstrom)
(inline_tests)
(preprocess (pps ppx_inline_test)))
(libraries angstrom))
27 changes: 0 additions & 27 deletions lib/semver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ let isOk = function
| Ok _ -> true
| Error _ -> false

let%test "natural number is ok" =
parse_string (nat <* end_of_input) "123" |> isOk

let%test "number with leading zero fails" =
parse_string (nat <* end_of_input) "0123" |> isOk |> not

let%test "0 is ok" =
parse_string (nat <* end_of_input) "0" |> isOk

let%test "alphanum fails" =
parse_string (nat <* end_of_input) "0hey" |> isOk |> not

let dot =
char '.'

Expand Down Expand Up @@ -121,15 +109,6 @@ let compare_identifiers ia ib =
| _, Ok _ -> 1
| _ -> compare ia ib

let%test "numeric lower than non-numeric" =
compare_identifiers "1" "beta" == -1

let%test "numeric comparison" =
compare_identifiers "2" "11" == -1

let%test "alphabetical comparison" =
compare_identifiers "alpha" "beta" == -1

let rec compare_prerelease is_first pra prb =
match pra, prb with
| [], [] -> 0
Expand All @@ -141,12 +120,6 @@ let rec compare_prerelease is_first pra prb =
else
compare_prerelease false ta tb

let%test "larger set has higher precedence" =
compare_prerelease true ["alpha"] ["alpha"; "1"] == -1

let%test "compare first non-equal identifiers" =
compare_prerelease true ["alpha"; "1"] ["alpha"; "beta"] == -1

let compare a b =
if a.major != b.major then
compare a.major b.major
Expand Down
1 change: 0 additions & 1 deletion semver2.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ depends: [
"ocaml" {>= "4.04.0"}
"dune" {build & >= "1.2.0"}
"angstrom" {>= "0.11.2"}
"ppx_inline_test" {with-test & >= "0.12.0"}
"ounit" {with-test & >= "1.0.2"}
"yojson" {with-test & >= "1.4.1"}
"odoc" {with-doc}
Expand Down

0 comments on commit e4228a9

Please sign in to comment.