package ppx_expect
Cram like framework for OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
v0.17.3.tar.gz
md5=a7daa59114638fd80f52b6adbb0db7ed
sha512=d26364f2c7c0a3d83e5ecc144f77875a00887853c72c03e0122d658acb4d1cb4c6d77fabc1222d775663db74f0345be2a33518dffac9feef57ece5e9e40dc709
doc/src/ppx_expect.runtime/current_file.ml.html
Source file current_file.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
open! Base let current = ref None let set ~filename_rel_to_project_root = match !current with | None -> current := Some filename_rel_to_project_root | Some current -> raise_s (Sexp.message "Expect_test_collector.set: there is already an active file" [ "old_file", sexp_of_string current ; "new_file", sexp_of_string filename_rel_to_project_root ]) ;; let unset () = match !current with | Some _ -> current := None | None -> raise_s (Sexp.message "Expect_test_collector.unset: there is no active file" []) ;; let get () = match !current with | Some fn -> fn | None -> raise_s (Sexp.message "Expect_test_collector.get: there is no active file" []) ;; let initial_dir = let dir_or_error = Or_error.try_with ~backtrace:true Stdlib.Sys.getcwd in lazy (Or_error.ok_exn dir_or_error) ;; let absolute_path file = if Stdlib.Filename.is_relative file then Stdlib.Filename.concat (Lazy.force initial_dir) file else file ;; let verify_that_file_is_current_exn ~line_number ~filename_rel_to_project_root = let registering_tests_for = get () in if not (String.equal filename_rel_to_project_root registering_tests_for) then Printf.ksprintf failwith "Trying to run an expect test from the wrong file.\n\ - test declared at %s:%d\n\ - trying to run it from %s\n" filename_rel_to_project_root line_number registering_tests_for else () ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>