From 5f97fd6e341ad166a41d9b29837af9aa7ce5f1ba Mon Sep 17 00:00:00 2001 From: Maiste Date: Thu, 19 Oct 2023 14:03:12 +0200 Subject: [PATCH] Add initial test --- ocaml/dune-project | 4 +++- ocaml/gilded_rose.opam | 2 ++ ocaml/test/dune | 3 ++- ocaml/test/gilded_rose.ml | 11 +++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ocaml/dune-project b/ocaml/dune-project index 09667c2b..6eb4f1cd 100644 --- a/ocaml/dune-project +++ b/ocaml/dune-project @@ -15,5 +15,7 @@ (description "The Gilded Rose Refactoring Kata in OCaml") (depends (ocaml (>= 4.08)) - dune)) + dune + ppx_deriving + (alcotest (>= 1.7.0)))) diff --git a/ocaml/gilded_rose.opam b/ocaml/gilded_rose.opam index 57ea38b4..2400917f 100644 --- a/ocaml/gilded_rose.opam +++ b/ocaml/gilded_rose.opam @@ -12,6 +12,8 @@ bug-reports: depends: [ "ocaml" {>= "4.08"} "dune" {>= "3.11"} + "ppx_deriving" + "alcotest" {>= "1.7.0"} "odoc" {with-doc} ] build: [ diff --git a/ocaml/test/dune b/ocaml/test/dune index 1d1b4a80..93d58f02 100644 --- a/ocaml/test/dune +++ b/ocaml/test/dune @@ -1,2 +1,3 @@ (test - (name gilded_rose)) + (name gilded_rose) + (libraries gilded_rose alcotest)) diff --git a/ocaml/test/gilded_rose.ml b/ocaml/test/gilded_rose.ml index e69de29b..7be406ff 100644 --- a/ocaml/test/gilded_rose.ml +++ b/ocaml/test/gilded_rose.ml @@ -0,0 +1,11 @@ +open Gilded_rose + +let test () = + let items = Items.v ~items:[ Item.v "Foo" 10 20 ] () in + Alcotest.(check string) + "Broken test" "Fixme" + (List.hd items |> fun item -> item.name) + +let () = + let open Alcotest in + run "Gilded Rose" [ ("Our first test", [ test_case "fixme" `Quick test ]) ]