Support texttest with OCaml

This commit is contained in:
Maiste 2023-10-24 14:04:28 +02:00
parent 50163ec350
commit 8d5803116f
No known key found for this signature in database
GPG Key ID: 030C4ED753794A0E
5 changed files with 15 additions and 6 deletions

View File

@ -16,6 +16,5 @@
(depends
(ocaml (>= 4.08))
dune
ppx_deriving
(alcotest (>= 1.7.0))))

View File

@ -12,7 +12,6 @@ bug-reports:
depends: [
"ocaml" {>= "4.08"}
"dune" {>= "3.11"}
"ppx_deriving"
"alcotest" {>= "1.7.0"}
"odoc" {with-doc}
]

View File

@ -1,3 +1,2 @@
(library
(preprocess (pps ppx_deriving.show))
(name gilded_rose))

View File

@ -1,14 +1,23 @@
module Item = struct
type t = { name : string; sell_in : int; quality : int } [@@deriving show]
type t = { name : string; sell_in : int; quality : int }
let show { name; sell_in; quality } =
Printf.printf "%s, %d, %d" name sell_in quality
let v name sell_in quality = { name; sell_in; quality }
end
module Items = struct
type items = Item.t list [@@deriving show]
type items = Item.t list
let v ?(items = []) () = items
let show items : string = show_items items
let show items =
List.iter
(fun item ->
Item.show item;
Printf.printf "\n")
items
let update_quality items =
let update_quality_items ({ name; sell_in; quality } as item : Item.t) =

View File

@ -39,4 +39,7 @@ diff_program:meld
#executable:${TEXTTEST_HOME}/php/fixtures/texttest_fixture.php
#interpreter:php
# Settings for the OCaml version
# executable:${TEXTTEST_HOME}/ocaml/_build/default/bin/main.exe
filename_convention_scheme:standard