fix a test for 4.04

This commit is contained in:
Simon Cruanes 2022-03-30 12:54:44 -04:00
parent 4ad8d91f7c
commit a4438dbdf6
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
3 changed files with 16 additions and 4 deletions

View file

@ -36,5 +36,10 @@ jobs:
- run: opam exec -- dune build @install -p tiny_httpd,tiny_httpd_camlzip - 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' }} if: ${{ matrix.os == 'ubuntu-latest' }}

View file

@ -36,7 +36,7 @@
(targets vfs.ml) (targets vfs.ml)
(deps (source_tree files) (:out test_output.txt.expected)) (deps (source_tree files) (:out test_output.txt.expected))
(enabled_if (= %{system} "linux")) (enabled_if (= %{system} "linux"))
(action (run ../src/bin/vfs_pack.exe -o %{targets} (action (run %{bin:tiny-httpd-vfs-pack} -o %{targets}
--mirror=files/ --mirror=files/
--file=test_out.txt,%{out} --file=test_out.txt,%{out}
--url=example_dot_com,http://example.com))) --url=example_dot_com,http://example.com)))
@ -44,6 +44,7 @@
(rule (rule
(targets vfs.ml) (targets vfs.ml)
(enabled_if (<> %{system} "linux")) (enabled_if (<> %{system} "linux"))
(package tiny_httpd)
(action (action
(with-stdout-to (with-stdout-to
%{targets} %{targets}

View file

@ -1,13 +1,19 @@
open Tiny_httpd_html open Tiny_httpd_html
let spf = Printf.sprintf 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() = let t1() =
html [] [ html [] [
head [] []; head [] [];
body [] [ body [] [
ul [A.style "list-style: circle"] ( ul [A.style "list-style: circle"] (
li[][pre [] [txt "a"; pre[][txt "c"; txt"d"]; txt "b"]] :: 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"]; pre [] [txt "a"; txt "b"];
body [] [ body [] [
ul' [A.style "list-style: circle"] [ 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)] li ~if_:(i<> 42) [A.id (spf "l%d" i)] [txt (spf "item %d" i)]
] ]
] ]