Skip to content

Commit

Permalink
Support texttest with OCaml
Browse files Browse the repository at this point in the history
  • Loading branch information
maiste committed Oct 24, 2023
1 parent 50163ec commit 8d58031
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
1 change: 0 additions & 1 deletion ocaml/dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
(depends
(ocaml (>= 4.08))
dune
ppx_deriving
(alcotest (>= 1.7.0))))

1 change: 0 additions & 1 deletion ocaml/gilded_rose.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ bug-reports:
depends: [
"ocaml" {>= "4.08"}
"dune" {>= "3.11"}
"ppx_deriving"
"alcotest" {>= "1.7.0"}
"odoc" {with-doc}
]
Expand Down
1 change: 0 additions & 1 deletion ocaml/lib/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
(library
(preprocess (pps ppx_deriving.show))
(name gilded_rose))
15 changes: 12 additions & 3 deletions ocaml/lib/gilded_rose.ml
Original file line number Diff line number Diff line change
@@ -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) =
Expand Down
3 changes: 3 additions & 0 deletions texttests/config.gr
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8d58031

Please sign in to comment.