1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192openExpect_test_commonopenPpxliblettransl_loc(loc:Location.t):File.Location.t={filename=File.Name.of_stringloc.loc_start.pos_fname;line_start=loc.loc_start.pos_bol;line_number=loc.loc_start.pos_lnum;start_pos=loc.loc_start.pos_cnum;end_pos=loc.loc_end.pos_cnum};;typedata=Location.t*string*stringoptiontypekind=|Normal|Exact|Unreachable|Outputletmake~kindpayload~(extension_id_loc:Location.t)=letbody_loc,body,tag=matchkind,payloadwith|Unreachable,Some(loc,_,_)->Location.raise_errorf~loc"expect.unreachable accepts no payload"()|Unreachable,None->({extension_id_locwithloc_start=extension_id_loc.loc_end},Expectation.Body.Unreachable,Some"")|Normal,Some(loc,s,tag)->loc,Prettys,tag|Exact,Some(loc,s,tag)->loc,Exacts,tag|Output,Some(loc,_,_)->Location.raise_errorf~loc"expect.output accepts no payload"()|Output,None->({extension_id_locwithloc_start=extension_id_loc.loc_end},Expectation.Body.Output,None)|_,None->({extension_id_locwithloc_start=extension_id_loc.loc_end},Expectation.Body.Pretty"",Some"")inletres:Expectation.Raw.t={tag;body;extid_location=transl_locextension_id_loc;body_location=transl_locbody_loc}in(* Check that we are not in this case:
{[
[%expect {|foo
bar
|}]
]}
*)matchbodywith|Exact_|Output|Unreachable->res|Prettys->letlen=String.lengthsinletgeti=ifi>=lenthenNoneelseSomes.[i]inletrecfirst_linei=matchgetiwith|None->()|Some(' '|'\t'|'\r')->first_line(i+1)|Some'\n'->()|Some_->first_line_has_stuff(i+1)andfirst_line_has_stuffi=matchgetiwith|None->()|Some'\n'->rest_must_be_empty(i+1)|Some_->first_line_has_stuff(i+1)andrest_must_be_emptyi=matchgetiwith|None->()|Some(' '|'\t'|'\r'|'\n')->rest_must_be_empty(i+1)|Some_->Location.raise_errorf~loc:body_loc"Multi-line expectations must start with an empty line"inifkind=Normalthenfirst_line0;res;;letpattern()=Ast_pattern.(map(single_expr_payload(pexp_loc__(pexp_constant(pconst_string______))))~f:(funflocs_tag->f(Some(loc,s,tag)))|||map(pstrnil)~f:(funf->fNone));;