356 | 356 |
Utf8 = unicode:characters_to_binary(Unicode),
|
357 | 357 |
io:setopts(standard_error, [{encoding, utf8}]),
|
358 | 358 |
OptSpecsWithDefault = [{utf8, undefined, "utf8", {utf8_binary, Utf8}, "UTF-8 arg"}],
|
|
359 |
UsageBin = unicode:characters_to_binary(getopt:usage_options(OptSpecsWithDefault)),
|
359 | 360 |
[{"Empty utf8_binary argument",
|
360 | 361 |
?_assertEqual({ok, {[{utf8, <<>>}], []}}, parse(OptSpecList, ["--utf8", ""]))},
|
361 | 362 |
{"Non empty utf8_binary argument",
|
|
363 | 364 |
{"Default utf8_binary argument",
|
364 | 365 |
?_assertEqual({ok, {[{utf8, Utf8}], []}}, parse(OptSpecsWithDefault, []))},
|
365 | 366 |
{"Default utf8_binary argument usage",
|
366 | |
?_assert(is_list(string:find(getopt:usage_options(OptSpecsWithDefault), Unicode)))}].
|
|
367 |
?_assertEqual(1, length(binary:matches(UsageBin, Utf8)))}].
|