From df8609586a29c17e5e3ab2cc1e72fb2c6fd44555 Mon Sep 17 00:00:00 2001 From: Jayesh Bhoot Date: Thu, 25 Jul 2024 11:15:21 +0530 Subject: [PATCH] improve assertion error messages with a printer --- test/test.ml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/test.ml b/test/test.ml index 3dcc68e..e56408e 100644 --- a/test/test.ml +++ b/test/test.ml @@ -47,7 +47,7 @@ let suites = [ ("parse-select-list" >:: fun _ -> let soup = page "list" |> parse in let test selector expected_count = - assert_equal ~msg:selector + assert_equal ~msg:selector ~printer:string_of_int (soup |> select selector |> count) expected_count in @@ -138,7 +138,7 @@ let suites = [ ("parse-select-quoted" >:: fun _ -> let soup = page "quoted" |> parse in let test selector expected_count = - assert_equal ~msg:selector + assert_equal ~msg:selector ~printer:string_of_int (soup |> select selector |> count) expected_count in @@ -185,7 +185,7 @@ let suites = [ ("parse-select-escaped" >:: fun _ -> let soup = page "quoted" |> parse in let test selector expected_count = - assert_equal ~msg:selector + assert_equal ~msg:selector ~printer:string_of_int (soup |> select selector |> count) expected_count in @@ -206,7 +206,7 @@ let suites = [ ("parse-select-html5" >:: fun _ -> let soup = page "html5" |> parse in let test selector expected_count = - assert_equal ~msg:selector (soup $$ selector |> count) expected_count + assert_equal ~msg:selector ~printer:string_of_int (soup $$ selector |> count) expected_count in test "nav" 1; @@ -218,7 +218,7 @@ let suites = [ test "footer" 1); ("parse-select-google" >:: fun _ -> - assert_equal (page "google" |> parse $$ "form[action]" |> count) 1); + assert_equal ~printer:string_of_int (page "google" |> parse $$ "form[action]" |> count) 1); ("parse-error" >:: fun _ -> let soup = parse "

" in @@ -264,7 +264,7 @@ let suites = [ ("generalized-select" >:: fun _ -> let soup = page "list" |> parse in let test root selector expected_count = - assert_equal ~msg:selector + assert_equal ~msg:selector ~printer:string_of_int (root |> select selector |> count) expected_count in @@ -277,7 +277,7 @@ let suites = [ ("select-attribute-operators" >:: fun _ -> let soup = "
" |> parse in - assert_equal (soup $$ "form[action=/continue]" |> count) 1); + assert_equal ~printer:string_of_int (soup $$ "form[action=/continue]" |> count) 1); ("select_one" >:: fun _ -> let soup = page "list" |> parse in