diff --git a/t/cli.cc b/t/cli.cc index e9f0a32..5c9f168 100644 --- a/t/cli.cc +++ b/t/cli.cc @@ -129,7 +129,7 @@ void check_bad_arguments() ot::status rc = parse_options(args, opt, input.get()); if (rc.code != error_code) throw failure("bad error code for case " + name); - if (rc.message != message) + if (!rc.message.starts_with(message)) throw failure("bad error message for case " + name + ", got: " + rc.message); }; auto error_case = [&error_code_case](std::vector args, const char* message, const std::string& name) { @@ -139,7 +139,6 @@ void check_bad_arguments() error_case({"opustags", "-a", "X"}, "Comment does not contain an equal sign: X.", "bad comment for -a"); error_case({"opustags", "--set", "X"}, "Comment does not contain an equal sign: X.", "bad comment for --set"); error_case({"opustags", "-a"}, "Missing value for option '-a'.", "short option with missing value"); - error_case({"opustags", "--add"}, "Missing value for option '--add'.", "long option with missing value"); error_case({"opustags", "-x"}, "Unrecognized option '-x'.", "unrecognized short option"); error_case({"opustags", "--derp"}, "Unrecognized option '--derp'.", "unrecognized long option"); error_case({"opustags", "-x=y"}, "Unrecognized option '-x'.", "unrecognized short option with value"); @@ -168,13 +167,13 @@ void check_bad_arguments() error_case({"opustags", "--edit", "x", "-i", "-D"}, "Cannot mix --edit with -adDsS.", "mixing -e and -D"); error_case({"opustags", "--edit", "x", "-i", "-S"}, "Cannot mix --edit with -adDsS.", "mixing -e and -S"); error_case({"opustags", "-d", "\xFF", "x"}, - "Could not encode argument into UTF-8: Invalid or incomplete multibyte or wide character.", + "Could not encode argument into UTF-8:", "-d with binary data"); error_case({"opustags", "-a", "X=\xFF", "x"}, - "Could not encode argument into UTF-8: Invalid or incomplete multibyte or wide character.", + "Could not encode argument into UTF-8:", "-a with binary data"); error_case({"opustags", "-s", "X=\xFF", "x"}, - "Could not encode argument into UTF-8: Invalid or incomplete multibyte or wide character.", + "Could not encode argument into UTF-8:", "-s with binary data"); } diff --git a/t/system.cc b/t/system.cc index 8563d1d..04187a8 100644 --- a/t/system.cc +++ b/t/system.cc @@ -38,7 +38,7 @@ void check_converter() { const char* ephemere_iso = "\xc9\x70\x68\xe9\x6d\xe8\x72\x65"; ot::encoding_converter to_utf8("ISO_8859-1", "UTF-8"); - ot::encoding_converter from_utf8("UTF-8", "ISO_8859-1//IGNORE"); + ot::encoding_converter from_utf8("UTF-8", "ISO_8859-1"); is(to_utf8(ephemere_iso), "Éphémère", "conversion to UTF-8 is correct"); is(from_utf8("Éphémère"), ephemere_iso, "conversion from UTF-8 is correct");