From 0f20d4d51f27ee7198813165d84f9cf0d7cc8c9c Mon Sep 17 00:00:00 2001 From: na4zagin3 Date: Mon, 19 Oct 2020 11:46:58 +0900 Subject: [PATCH] Support SATySFi versions with dev prefix --- src/satysfi/version.ml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/satysfi/version.ml b/src/satysfi/version.ml index bf3602f..6788a55 100644 --- a/src/satysfi/version.ml +++ b/src/satysfi/version.ml @@ -47,12 +47,18 @@ let read_local_packages = function let extract_version_string = let re = let open Re in + let version_char = + alt [ + alnum; + char '.'; + ] + in seq [ bos; rep space; str "SATySFi version"; rep space; - rep graph + rep version_char |> group; ] |> compile @@ -79,7 +85,7 @@ let%expect_test "extract_version_string: valid: dev" = extract_version_string " SATySFi version v0.0.5-27-gc841df2\n" |> printf !"%{sexp: string option}"; [%expect{| - (v0.0.5-27-gc841df2) |}] + (v0.0.5) |}] let parse_version_output str = extract_version_string str @@ -91,6 +97,12 @@ let%expect_test "parse_version_output: valid: normal" = [%expect{| (Satysfi_0_0_5) |}] +let%expect_test "parse_version_output: valid: dev" = + parse_version_output " SATySFi version v0.0.5-27-gc841df2\n" + |> printf !"%{sexp: t option}"; + [%expect{| + (Satysfi_0_0_5) |}] + let get_current_version_cmd = let open Shexp_process in let open Shexp_process.Infix in