123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461(* The easiest way to see what examples this library actually generates is to check expect
test output in [test_*.ml] files.
This file does not guarantee comprehensive coverage, which is part of why we also use
quickcheck, although even the combination is not a hard-and-fast guarantee. The
purposes of these examples are (1) allowing human inspection of expect tests and (2)
giving some reasonable confidence that we have covered many important cases. If we
discover more important cases in the future, we should add them here. *)open!CoreincludeExamples_intfmoduleWith_prefix=structincludeWith_prefixletcreatet~prefix={t;prefix}letmap{t;prefix}~f={t=ft;prefix=fprefix}letinvarianta_invariant{t;prefix}=a_invariantt;a_invariantprefix;;endmoduleWith_suffix=structincludeWith_suffixletcreatet~suffix={t;suffix}letmap{t;suffix}~f={t=ft;suffix}letinvarianta_invariant{t;suffix}=a_invariantt;File_path.Relative.invariantsuffix;;endletpair_map~f1~f2(x1,x2)=f1x1,f2x2(* prompts us to think about all three cases *)letlist_for_of_string~canonical~non_canonical~invalid=List.concat[canonical;non_canonical;invalid];;modulePart=structletof_string=File_path.Part.of_stringletcanonical=[".";"..";"filename.txt";"bin";".hidden";"This is a sentence; it has punctuation, capitalization, and spaces!";"\001\255"];;letnon_canonical=[]letinvalid=["";"invalid/slash";"invalid\000null"]letstrings_for_of_string=list_for_of_string~canonical~non_canonical~invalidletstrings_for_conversion=canonicalletstrings_for_compare=[".";"..";"filename.txt";"bin";"bin.exe";"binary";".hidden";"-dot-is-not-always-first";"This is a sentence; it has punctuation, capitalization, and spaces!";"\001\255";"\255\001"];;letstrings_for_append_to_basename=[".","x";"..","y";"a",".b";"b","invalid/slash";"c","invalid\000null";"long-hyphenated-name-ending-in","-this"];;letstring_lists_for_conversion=letlen0=[[]]inletlen1=List.mapstrings_for_conversion~f:List.returninletlen2=List.concat_mapstrings_for_conversion~f:(funpart->[[part;"."];["..";part]])@[[".hidden";"bin.exe"]]inletlen3=[[".hidden";"bin";"exe.file"]]inList.concat[len0;len1;len2;len3];;letfor_conversion=strings_for_conversion|>List.map~f:of_stringletfor_compare=strings_for_compare|>List.map~f:of_stringletfor_append_to_basename=strings_for_append_to_basename|>List.map~f:(pair_map~f1:of_string~f2:Fn.id);;letlists_for_conversion=string_lists_for_conversion|>List.map~f:(List.map~f:of_string);;endmoduleRelative=structletof_string=File_path.Relative.of_stringletcanonical=Part.canonical@["./.";"../..";"././.";"bin/exe";"bin/exe/file"]letnon_canonical=["./";".//.";".//.//";"bin/exe/";"bin//exe//file";"bin//exe//file/"];;letinvalid=["";"invalid/\000/null";"/invalid/absolute"]letstrings_for_of_string=list_for_of_string~canonical~non_canonical~invalidletstrings_for_conversion=canonicalletstrings_for_compare=Part.strings_for_compare@["./.";"./..";"../.";"../..";"././.";"bin/exe";"bin/exe/file";"bin/exe.file"];;letstrings_for_append_to_basename=[".","x";"..","y";"a",".b";"a/b",".c";"a/b/c",".d";"a/b/c","";"a/b/c","invalid/slash";"a/b/c","invalid\000null";"long/chain/of/names/ending/in","-this"];;letstrings_for_append_part=[".","file";"dir",".";"..","..";"a","b";"a/b","c";"a/b/c","d";"long/chain/of/names/ending/in","this"];;letstrings_for_basename_and_dirname=[".";"..";"singleton"]@List.mapstrings_for_append_part~f:(fun(basename,dirname)->basename^"/"^dirname);;letstrings_for_prepend_part=[".","file";"dir",".";"..","..";"a","b";"a","b/c";"a","b/c/d";"long","chain/of/names/ending/in/this"];;letstrings_for_top_dir=[".";"..";"singleton"]@List.mapstrings_for_prepend_part~f:(fun(part,relative)->part^"/"^relative);;letstrings_for_append=[".","file";"dir",".";"..","..";"a","b/c/d";"a/b","c/d";"a/b/c","d";"long/chain/of/names","ending/in/this"];;letstrings_for_simplify=Part.strings_for_conversion@["a/b";"a/b/.";"a/./b";"./a/b";"./a/./b/.";"a/b/./.";"a/././b";"././a/b";"././a/././b/./.";"a/b/..";"a/../b";"../a/b";"../a/../b/..";"a/b/../..";"a/../../b";"../../a/b";"../../a/../../b/../..";"a/b/./..";"a/./../b";"./../a/b";"./../a/./../b/./..";"a/b/../.";"a/.././b";".././a/b";".././a/.././b/../."];;letstrings_for_chop_prefix=letopenWith_prefixin[{prefix=".";t=".."};{prefix="./a";t="./b"};{prefix="a/b";t="c/d"};{prefix="a/b/c";t="a"};{prefix="a/b/c";t="a/b"}]@List.map[".";"..";"a/b/c"]~f:(funstring->{prefix=string;t=string})@List.mapstrings_for_append~f:(fun(prefix,suffix)->{prefix;t=prefix^"/"^suffix});;letstrings_for_chop_suffix=letopenWith_suffixin[{suffix=File_path.Relative.of_string".";t=".."};{suffix=File_path.Relative.of_string"a/.";t="b/."};{suffix=File_path.Relative.of_string"a/b";t="c/d"};{suffix=File_path.Relative.of_string"a/b/c";t="c"};{suffix=File_path.Relative.of_string"a/b/c";t="b/c"}]@List.map[".";"..";"a/b/c"]~f:(funstring->{suffix=File_path.Relative.of_stringstring;t=string})@List.mapstrings_for_append~f:(fun(prefix,suffix)->{suffix=File_path.Relative.of_stringsuffix;t=prefix^"/"^suffix});;letfor_conversion=strings_for_conversion|>List.map~f:of_stringletfor_compare=strings_for_compare|>List.map~f:of_stringletfor_basename_and_dirname=strings_for_basename_and_dirname|>List.map~f:of_stringletfor_top_dir=strings_for_top_dir|>List.map~f:of_stringletfor_append_to_basename=strings_for_append_to_basename|>List.map~f:(pair_map~f1:of_string~f2:Fn.id);;letfor_append_part=strings_for_append_part|>List.map~f:(pair_map~f1:of_string~f2:Part.of_string);;letfor_prepend_part=strings_for_prepend_part|>List.map~f:(pair_map~f1:Part.of_string~f2:of_string);;letfor_chop_prefix=strings_for_chop_prefix|>List.map~f:(With_prefix.map~f:of_string);;letfor_chop_suffix=strings_for_chop_suffix|>List.map~f:(With_suffix.map~f:of_string);;letfor_append=strings_for_append|>List.map~f:(pair_map~f1:of_string~f2:of_string);;letfor_simplify=strings_for_simplify|>List.map~f:of_stringendmoduleAbsolute=structletof_string=File_path.Absolute.of_stringletmake_absolutestring="/"^stringletcanonical=["/"]@List.mapRelative.canonical~f:make_absoluteletnon_canonical=["//";"//."]@List.mapRelative.non_canonical~f:make_absoluteletinvalid=["";"/invalid/\000/null";"invalid/relative"]letstrings_for_of_string=list_for_of_string~canonical~non_canonical~invalidletstrings_for_conversion=["/"]@List.mapRelative.strings_for_conversion~f:make_absolute;;letstrings_for_compare=["/"]@List.mapRelative.strings_for_compare~f:make_absolute;;letstrings_for_basename_and_dirname=["/"]@List.mapRelative.strings_for_basename_and_dirname~f:make_absolute;;letstrings_for_append_to_basename=["/","";"/","x";"/","invalid/slash";"/","invalid\000null"]@List.mapRelative.strings_for_append_to_basename~f:(pair_map~f1:make_absolute~f2:Fn.id);;letstrings_for_append_part=["/",".";"/","..";"/","singleton"]@List.mapRelative.strings_for_append_part~f:(pair_map~f1:make_absolute~f2:Fn.id);;letstrings_for_append=["/",".";"/","..";"/","a/b/c"]@List.mapRelative.strings_for_append~f:(pair_map~f1:make_absolute~f2:Fn.id);;letstrings_for_chop_prefix=[With_prefix.create"/"~prefix:"/"]@List.mapRelative.strings_for_chop_prefix~f:(With_prefix.map~f:make_absolute);;letstrings_for_chop_suffix=[With_suffix.create"/"~suffix:File_path.Relative.dot]@List.mapRelative.strings_for_chop_suffix~f:(funwith_suffix->{with_suffixwitht=make_absolutewith_suffix.t});;letstrings_for_simplify=["/"]@List.mapRelative.strings_for_simplify~f:make_absolute;;letfor_conversion=strings_for_conversion|>List.map~f:of_stringletfor_compare=strings_for_compare|>List.map~f:of_stringletfor_basename_and_dirname=strings_for_basename_and_dirname|>List.map~f:of_stringletfor_append_to_basename=strings_for_append_to_basename|>List.map~f:(pair_map~f1:of_string~f2:Fn.id);;letfor_append_part=strings_for_append_part|>List.map~f:(pair_map~f1:of_string~f2:Part.of_string);;letfor_chop_prefix=strings_for_chop_prefix|>List.map~f:(With_prefix.map~f:of_string);;letfor_chop_suffix=strings_for_chop_suffix|>List.map~f:(With_suffix.map~f:of_string);;letfor_append=strings_for_append|>List.map~f:(pair_map~f1:of_string~f2:Relative.of_string);;letfor_simplify=strings_for_simplify|>List.map~f:of_stringendmodulePath=structletof_string=File_path.of_stringletcanonical=Relative.canonical@Absolute.canonicalletnon_canonical=Relative.non_canonical@Absolute.non_canonicalletinvalid=["";"invalid/\000/null"]letstrings_for_of_string=list_for_of_string~canonical~non_canonical~invalidletstrings_for_conversion=Relative.strings_for_conversion@Absolute.strings_for_conversion;;letstrings_for_compare=Relative.strings_for_compare@Absolute.strings_for_compareletstrings_for_basename_and_dirname=Relative.strings_for_basename_and_dirname@Absolute.strings_for_basename_and_dirname;;letstrings_for_append_to_basename=Relative.strings_for_append_to_basename@Absolute.strings_for_append_to_basename;;letstrings_for_append_part=Relative.strings_for_append_part@Absolute.strings_for_append_part;;letstrings_for_append=Relative.strings_for_append@Absolute.strings_for_appendletstrings_for_chop_prefix=Relative.strings_for_chop_prefix@Absolute.strings_for_chop_prefix@[{t="/";prefix="."};{t=".";prefix="/"};{t="/a/b/c";prefix="a/b"};{t="a/b/c";prefix="/a/b"}];;letstrings_for_chop_suffix=Relative.strings_for_chop_suffix@Absolute.strings_for_chop_suffix;;letstrings_for_make_absolute=List.mapAbsolute.strings_for_append~f:(fun(prefix,suffix)->suffix,prefix)@["/","/."]@List.mapAbsolute.strings_for_append~f:(fun(prefix,suffix)->Absolute.make_absolutesuffix,prefix);;letstrings_for_make_relative=List.mapAbsolute.strings_for_append~f:(fun(prefix,suffix)->suffix,prefix)@List.mapAbsolute.strings_for_chop_prefix~f:(fun{t;prefix}->t,prefix);;letstrings_for_variant=strings_for_conversionletstrings_for_simplify=Relative.strings_for_simplify@Absolute.strings_for_simplifyletfor_conversion=strings_for_conversion|>List.map~f:of_stringletfor_compare=strings_for_compare|>List.map~f:of_stringletfor_basename_and_dirname=strings_for_basename_and_dirname|>List.map~f:of_stringletfor_append_to_basename=strings_for_append_to_basename|>List.map~f:(pair_map~f1:of_string~f2:Fn.id);;letfor_append_part=strings_for_append_part|>List.map~f:(pair_map~f1:of_string~f2:Part.of_string);;letfor_chop_prefix=strings_for_chop_prefix|>List.map~f:(With_prefix.map~f:of_string);;letfor_chop_suffix=strings_for_chop_suffix|>List.map~f:(With_suffix.map~f:of_string);;letfor_append=strings_for_append|>List.map~f:(pair_map~f1:of_string~f2:Relative.of_string);;letfor_simplify=strings_for_simplify|>List.map~f:of_stringletfor_make_absolute=strings_for_make_absolute|>List.map~f:(pair_map~f1:of_string~f2:Absolute.of_string);;letfor_make_relative=strings_for_make_relative|>List.map~f:(pair_map~f1:of_string~f2:Absolute.of_string);;letvariant_for_conversion=List.mapstrings_for_variant~f:(funstring:File_path.Variant.t->ifString.is_prefixstring~prefix:"/"thenAbsolute(Absolute.of_stringstring)elseRelative(Relative.of_stringstring));;endincludePath