From a4438dbdf6eec582928fe07411fc3c7347e008a8 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 30 Mar 2022 12:54:44 -0400 Subject: [PATCH] fix a test for 4.04 --- .github/workflows/main.yml | 7 ++++++- examples/dune | 3 ++- tests/html/makehtml.ml | 10 ++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index efd05b75..906464eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,5 +36,10 @@ jobs: - run: opam exec -- dune build @install -p tiny_httpd,tiny_httpd_camlzip - - run: opam exec -- dune build @src/runtest @examples/runtest @tests/runtest + - run: opam exec -- dune build @src/runtest @examples/runtest @tests/runtest -p tiny_httpd + if: ${{ matrix.os == 'ubuntu-latest' }} + + - run: opam install tiny_httpd + + - run: opam exec -- dune build @src/runtest @examples/runtest @tests/runtest -p tiny_httpd_camlzip if: ${{ matrix.os == 'ubuntu-latest' }} diff --git a/examples/dune b/examples/dune index 92c22b90..6f7bc563 100644 --- a/examples/dune +++ b/examples/dune @@ -36,7 +36,7 @@ (targets vfs.ml) (deps (source_tree files) (:out test_output.txt.expected)) (enabled_if (= %{system} "linux")) - (action (run ../src/bin/vfs_pack.exe -o %{targets} + (action (run %{bin:tiny-httpd-vfs-pack} -o %{targets} --mirror=files/ --file=test_out.txt,%{out} --url=example_dot_com,http://example.com))) @@ -44,6 +44,7 @@ (rule (targets vfs.ml) (enabled_if (<> %{system} "linux")) + (package tiny_httpd) (action (with-stdout-to %{targets} diff --git a/tests/html/makehtml.ml b/tests/html/makehtml.ml index 2a1c85e6..aaace271 100644 --- a/tests/html/makehtml.ml +++ b/tests/html/makehtml.ml @@ -1,13 +1,19 @@ open Tiny_httpd_html let spf = Printf.sprintf +let list_init n f = + let rec loop i = + if i=n then [] + else f i :: loop (i+1) + in loop 0 + let t1() = html [] [ head [] []; body [] [ ul [A.style "list-style: circle"] ( li[][pre [] [txt "a"; pre[][txt "c"; txt"d"]; txt "b"]] :: - List.init 100 (fun i -> li [A.id (spf "l%d" i)] [txt (spf "item %d" i)]) + list_init 100 (fun i -> li [A.id (spf "l%d" i)] [txt (spf "item %d" i)]) ) ] ] @@ -19,7 +25,7 @@ let t2() = pre [] [txt "a"; txt "b"]; body [] [ ul' [A.style "list-style: circle"] [ - sub_l @@ List.init 100 @@ fun i -> + sub_l @@ list_init 100 @@ fun i -> li ~if_:(i<> 42) [A.id (spf "l%d" i)] [txt (spf "item %d" i)] ] ]