From 8b328c666bec4f9529acc6080cd0387d63cf8b7f Mon Sep 17 00:00:00 2001 From: Simon Skorokhodov Date: Mon, 18 Jan 2021 10:47:26 +0100 Subject: [PATCH] Fix tests for Erlang < 20 --- test/getopt_test.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/getopt_test.erl b/test/getopt_test.erl index 4c7108f..0231c7d 100644 --- a/test/getopt_test.erl +++ b/test/getopt_test.erl @@ -357,6 +357,7 @@ utf8_binary_test_() -> Utf8 = unicode:characters_to_binary(Unicode), io:setopts(standard_error, [{encoding, utf8}]), OptSpecsWithDefault = [{utf8, undefined, "utf8", {utf8_binary, Utf8}, "UTF-8 arg"}], + UsageBin = unicode:characters_to_binary(getopt:usage_options(OptSpecsWithDefault)), [{"Empty utf8_binary argument", ?_assertEqual({ok, {[{utf8, <<>>}], []}}, parse(OptSpecList, ["--utf8", ""]))}, {"Non empty utf8_binary argument", @@ -364,4 +365,4 @@ utf8_binary_test_() -> {"Default utf8_binary argument", ?_assertEqual({ok, {[{utf8, Utf8}], []}}, parse(OptSpecsWithDefault, []))}, {"Default utf8_binary argument usage", - ?_assert(is_list(string:find(getopt:usage_options(OptSpecsWithDefault), Unicode)))}]. + ?_assertEqual(1, length(binary:matches(UsageBin, Utf8)))}].