compat: test cannot use let-ops

This commit is contained in:
Simon Cruanes 2023-06-01 15:21:52 -04:00
parent 2b4cf1e663
commit b72fac90c7
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -182,10 +182,9 @@ eq
~printer:(errpp Q.Print.(pair string string)) ~printer:(errpp Q.Print.(pair string string))
(Ok ("hello", " world")) (Ok ("hello", " world"))
(parse_string (parse_string
(let* slice = take_if (fun c -> c <> ' ') in ( take_if (fun c -> c <> ' ') >>= fun slice ->
let* x = recurse slice all_str in recurse slice all_str >>= fun x ->
let* rest = all_str in all_str >>= fun rest -> return (x, rest) )
return (x, rest))
"hello world") "hello world")
;; ;;
@ -193,8 +192,7 @@ eq
~printer:(errpp Q.Print.(string)) ~printer:(errpp Q.Print.(string))
(Ok "ahahahah") (Ok "ahahahah")
(parse_string (parse_string
(let+ slice, () = take_until_success eoi in (take_until_success eoi >|= fun (slice, ()) -> Slice.to_string slice)
Slice.to_string slice)
"ahahahah") "ahahahah")
;; ;;
@ -327,12 +325,11 @@ eq
(let parser_complex1 = (let parser_complex1 =
let ws = skip_white in let ws = skip_white in
let s2 = lookahead_ignore @@ string "Section2" in let s2 = lookahead_ignore @@ string "Section2" in
let* slice1, () = ws *> string "Section1" *> take_until_success s2 in ws *> string "Section1" *> take_until_success s2 >>= fun (slice1, ()) ->
let* slice2, () = ws *> string "Section2" *> take_until_success (ws *> eoi)
ws *> string "Section2" *> take_until_success (ws *> eoi) >>= fun (slice2, ()) ->
in recurse slice1 (each_split ~on_char:';' all_str) >>= fun sect1 ->
let* sect1 = recurse slice1 (each_split ~on_char:';' all_str) in recurse slice2 (each_split ~on_char:';' all_str) >>= fun sect2 ->
let* sect2 = recurse slice2 (each_split ~on_char:';' all_str) in
return (sect1, sect2) return (sect1, sect2)
in in
parse_string parser_complex1 parse_string parser_complex1