From 1a4afd5d411a035d68f1f40b97223404f4722c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Tue, 29 Aug 2023 15:38:23 +0200 Subject: [PATCH 1/2] Adding tests to make sure things work --- dune-project | 1 + test/dune | 8 ++++++-- test/stringCodepointSplitter.ml | 0 test/stringCodepointSplitter.t | 11 +++++++++++ test/stringCodepointSplitterTest.ml | 4 ++++ 5 files changed, 22 insertions(+), 2 deletions(-) delete mode 100644 test/stringCodepointSplitter.ml create mode 100644 test/stringCodepointSplitter.t create mode 100644 test/stringCodepointSplitterTest.ml diff --git a/dune-project b/dune-project index f63ebd6..428891d 100644 --- a/dune-project +++ b/dune-project @@ -1,4 +1,5 @@ (lang dune 3.9) +(cram enable) (name stringCodepointSplitter) (version 0.0.1) diff --git a/test/dune b/test/dune index abafc95..0caa2b6 100644 --- a/test/dune +++ b/test/dune @@ -1,2 +1,6 @@ -(test - (name stringCodepointSplitter)) +(executable + (libraries stringCodepointSplitter) + (name stringCodepointSplitterTest)) + +(cram + (deps ./stringCodepointSplitterTest.exe)) diff --git a/test/stringCodepointSplitter.ml b/test/stringCodepointSplitter.ml deleted file mode 100644 index e69de29..0000000 diff --git a/test/stringCodepointSplitter.t b/test/stringCodepointSplitter.t new file mode 100644 index 0000000..f50da59 --- /dev/null +++ b/test/stringCodepointSplitter.t @@ -0,0 +1,11 @@ +ASCII only + $ ./stringCodepointSplitterTest.exe abc + a + b + c + +Still simple but not just ASCII + $ ./stringCodepointSplitterTest.exe «—» + « + — + » diff --git a/test/stringCodepointSplitterTest.ml b/test/stringCodepointSplitterTest.ml new file mode 100644 index 0000000..76105fe --- /dev/null +++ b/test/stringCodepointSplitterTest.ml @@ -0,0 +1,4 @@ +let () = + Sys.argv.(1) + |> StringCodepointSplitter.split_string_by_unicode_codepoint + |> List.iter print_endline From 67acf25cd7af99d0cccfa9473061d6b7d95dc829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Tue, 29 Aug 2023 15:38:36 +0200 Subject: [PATCH 2/2] Replacing dynlink by just using dune to link at compile time --- lib/dune | 2 +- lib/stringCodepointSplitter.ml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/dune b/lib/dune index 7ae24b9..152dbb8 100644 --- a/lib/dune +++ b/lib/dune @@ -1,4 +1,4 @@ (library (name stringCodepointSplitter) (public_name stringCodepointSplitter) - (libraries uutf findlib.dynload)) + (libraries uutf)) diff --git a/lib/stringCodepointSplitter.ml b/lib/stringCodepointSplitter.ml index 47ec57a..e5657b5 100644 --- a/lib/stringCodepointSplitter.ml +++ b/lib/stringCodepointSplitter.ml @@ -13,9 +13,6 @@ Under MIT License It only contains [split_string_by_unicode_codepoint], which splits an OCaml string [str] to a [string list] *) -let _ = Findlib.init ();; -Fl_dynload.load_packages ["uutf"];; - (** Split an OCaml string [str] to a [string list]