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 1QJ3iR-0000tM-Qt for garchives@archives.gentoo.org; Sun, 08 May 2011 13:08:08 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3D7091C027; Sun, 8 May 2011 13:07:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 038E61C024 for ; Sun, 8 May 2011 13:07:14 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 84D7A1B404E for ; Sun, 8 May 2011 13:07:14 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id AA4C045B2A for ; Sun, 8 May 2011 13:07:13 +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: Subject: [gentoo-commits] proj/libbash:master commit in: src/core/, src/core/tests/ X-VCS-Repository: proj/libbash X-VCS-Files: src/core/symbols.hpp src/core/tests/symbols_test.cpp X-VCS-Directories: src/core/ src/core/tests/ X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: c15de9151925dd3ede93ac00ebac07e629c86b6c Date: Sun, 8 May 2011 13:07:13 +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: X-Archives-Hash: a3a91bc72d3d186d5ead184c21f96bb6 commit: c15de9151925dd3ede93ac00ebac07e629c86b6c Author: Mu Qiao gentoo org> AuthorDate: Fri Apr 29 08:45:05 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Sat May 7 07:03:23 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3Dc15de915 Core: return 0 if boost::lexical_cast fails Instead of throw an exception, we should return 0 as bash does. The exact bash implementation is a bit different so we need to specialize boost::lexical_cast in future. --- src/core/symbols.hpp | 2 +- src/core/tests/symbols_test.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/core/symbols.hpp b/src/core/symbols.hpp index 89fd657..2d6b6a5 100644 --- a/src/core/symbols.hpp +++ b/src/core/symbols.hpp @@ -73,7 +73,7 @@ public: } catch(boost::bad_lexical_cast& e) { - throw interpreter_exception("can't cast " + value + " to int"); + std::cerr << "can't cast " << value << " to int" << std::endl; } return result; } diff --git a/src/core/tests/symbols_test.cpp b/src/core/tests/symbols_tes= t.cpp index f151318..5853a4f 100644 --- a/src/core/tests/symbols_test.cpp +++ b/src/core/tests/symbols_test.cpp @@ -63,6 +63,8 @@ TEST(symbol_test, string_variable) // string contains integer value variable int_string("string", "123"); EXPECT_EQ(123, int_string.get_value()); + int_string.set_value("abc"); + EXPECT_EQ(0, int_string.get_value()); } =20 TEST(symbol_test, array_variable)