From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Sb6pu-0001Yf-6U for garchives@archives.gentoo.org; Sun, 03 Jun 2012 09:10:58 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AF5EAE080A; Sun, 3 Jun 2012 09:08:44 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 6E79BE080B for ; Sun, 3 Jun 2012 09:08:44 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CF04F1B402E for ; Sun, 3 Jun 2012 09:08:43 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 2DC9DE543B for ; Sun, 3 Jun 2012 09:08:42 +0000 (UTC) From: "Petteri Räty" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Petteri Räty" Message-ID: <1338028850.846f3e937c727996a114045f06f5a0c5ab660619.betelgeuse@gentoo> Subject: [gentoo-commits] proj/libbash:master commit in: src/builtins/tests/, src/builtins/ X-VCS-Repository: proj/libbash X-VCS-Files: src/builtins/declare_builtin.cpp src/builtins/shopt_builtin.cpp src/builtins/source_builtin.cpp src/builtins/tests/declare_tests.cpp src/builtins/tests/shopt_tests.cpp X-VCS-Directories: src/builtins/tests/ src/builtins/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 846f3e937c727996a114045f06f5a0c5ab660619 X-VCS-Branch: master Date: Sun, 3 Jun 2012 09:08:42 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 89ff9602-5031-4566-bf8b-4d301cc09f38 X-Archives-Hash: c796ad8fd06b2df4c60e8543d17a74e3 commit: 846f3e937c727996a114045f06f5a0c5ab660619 Author: Mu Qiao gentoo org> AuthorDate: Tue Mar 27 11:53:09 2012 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Sat May 26 10:40:50 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D846f3e93 Builtin: improve error output for some builtins --- src/builtins/declare_builtin.cpp | 8 ++++---- src/builtins/shopt_builtin.cpp | 6 +++--- src/builtins/source_builtin.cpp | 2 +- src/builtins/tests/declare_tests.cpp | 8 ++++---- src/builtins/tests/shopt_tests.cpp | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/builtins/declare_builtin.cpp b/src/builtins/declare_buil= tin.cpp index 1c85d61..db955c4 100644 --- a/src/builtins/declare_builtin.cpp +++ b/src/builtins/declare_builtin.cpp @@ -32,18 +32,18 @@ int declare_builtin::exec(const std::vector& bash_args) { if(bash_args.empty()) { - throw libbash::illegal_argument_exception("Arguments required for de= clare"); + throw libbash::illegal_argument_exception("declare: arguments requir= ed"); return 1; } else if(bash_args[0].size() !=3D 2) { - throw libbash::unsupported_exception("Multiple arguments are not sup= ported"); + throw libbash::unsupported_exception("declare: multiple arguments ar= e not supported"); return 1; } =20 if(bash_args[0][0] !=3D '-' && bash_args[0][0] !=3D '+') { - throw libbash::illegal_argument_exception("Invalid option for declar= e builtin"); + throw libbash::illegal_argument_exception("declare: invalid option")= ; return 1; } =20 @@ -108,7 +108,7 @@ int declare_builtin::exec(const std::vector& bash_args) throw libbash::unsupported_exception("declare " + bash_args[0] + "= is not supported yet"); return 1; default: - throw libbash::illegal_argument_exception("Unrecognized option for= declare: " + bash_args[0]); + throw libbash::illegal_argument_exception("declare: unrecognized o= ption: " + bash_args[0]); return 1; } } diff --git a/src/builtins/shopt_builtin.cpp b/src/builtins/shopt_builtin.= cpp index fd9e581..1e3da70 100644 --- a/src/builtins/shopt_builtin.cpp +++ b/src/builtins/shopt_builtin.cpp @@ -42,9 +42,9 @@ void shopt_builtin::print_opts() const int shopt_builtin::exec(const std::vector& bash_args) { if(bash_args.empty()) - throw libbash::illegal_argument_exception("Arguments required for sh= opt"); + throw libbash::illegal_argument_exception("shopt: arguments required= "); else if(bash_args[0].size() !=3D 2) - throw libbash::unsupported_exception("Multiple arguments are not sup= ported"); + throw libbash::unsupported_exception("shopt: multiple arguments are = not supported"); =20 switch(bash_args[0][1]) { @@ -61,7 +61,7 @@ int shopt_builtin::exec(const std::vector&= bash_args) case 'o': throw libbash::unsupported_exception("shopt " + bash_args[0] + " i= s not supported yet"); default: - throw libbash::illegal_argument_exception("Unrecognized option for= shopt: " + bash_args[0]); + throw libbash::illegal_argument_exception("shopt: unrecognized opt= ion: " + bash_args[0]); } =20 return 0; diff --git a/src/builtins/source_builtin.cpp b/src/builtins/source_builti= n.cpp index 91f3397..7af4f91 100644 --- a/src/builtins/source_builtin.cpp +++ b/src/builtins/source_builtin.cpp @@ -65,7 +65,7 @@ namespace { int source_builtin::exec(const std::vector& bash_args) { if(bash_args.size() =3D=3D 0) - throw libbash::illegal_argument_exception("should provide one argume= nt for source builtin"); + throw libbash::illegal_argument_exception("source: argument required= "); =20 const std::string& original_path =3D _walker.resolve("0")= ; _walker.define("0", bash_args.front(), true); diff --git a/src/builtins/tests/declare_tests.cpp b/src/builtins/tests/de= clare_tests.cpp index 686c816..19347ac 100644 --- a/src/builtins/tests/declare_tests.cpp +++ b/src/builtins/tests/declare_tests.cpp @@ -54,10 +54,10 @@ namespace =20 TEST(declare_builtin_test, invalid_arguments) { - test_declare("Arguments required = for declare", {}); - test_declare("Multiple arguments are n= ot supported", {"-ap"}); - test_declare("Invalid option for = declare builtin", {"_a"}); - test_declare("Unrecognized option= for declare: -L", {"-L"}); + test_declare("declare: arguments = required", {}); + test_declare("declare: multiple argume= nts are not supported", {"-ap"}); + test_declare("declare: invalid op= tion", {"_a"}); + test_declare("declare: unrecogniz= ed option: -L", {"-L"}); } =20 TEST(declare_builtin_test, _F) diff --git a/src/builtins/tests/shopt_tests.cpp b/src/builtins/tests/shop= t_tests.cpp index dc43dee..af2915b 100644 --- a/src/builtins/tests/shopt_tests.cpp +++ b/src/builtins/tests/shopt_tests.cpp @@ -69,8 +69,8 @@ TEST(shopt_builtin_test, enable_extglob) =20 TEST(shopt_builtin_test, invalid_argument) { - test_shopt_builtin("Arguments req= uired for shopt", {}); - test_shopt_builtin("Multiple arguments= are not supported", {"-so"}); + test_shopt_builtin("shopt: argume= nts required", {}); + test_shopt_builtin("shopt: multiple ar= guments are not supported", {"-so"}); test_shopt_builtin("shopt -q is not su= pported yet", {"-q"}); - test_shopt_builtin("Unrecognized = option for shopt: -d", {"-d"}); + test_shopt_builtin("shopt: unreco= gnized option: -d", {"-d"}); }