Merge pull request #490 from maiste/texttest-for-ocaml

Support texttest with OCaml
This commit is contained in:
Emily Bache 2023-10-25 10:56:55 +02:00 committed by GitHub
commit de1e9ed991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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