public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/libbash:master commit in: src/core/, src/core/tests/
Date: Sun,  8 May 2011 13:07:13 +0000 (UTC)	[thread overview]
Message-ID: <c15de9151925dd3ede93ac00ebac07e629c86b6c.betelgeuse@gentoo> (raw)

commit:     c15de9151925dd3ede93ac00ebac07e629c86b6c
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 29 08:45:05 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Sat May  7 07:03:23 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=c15de915

Core: return 0 if boost::lexical_cast<int> 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<int> 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_test.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>());
+  int_string.set_value("abc");
+  EXPECT_EQ(0, int_string.get_value<int>());
 }
 
 TEST(symbol_test, array_variable)



             reply	other threads:[~2011-05-08 13:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-08 13:07 Petteri Räty [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-27 23:03 [gentoo-commits] proj/libbash:master commit in: src/core/, src/core/tests/ Petteri Räty
2011-05-25 19:42 Petteri Räty
2011-05-23 14:34 Petteri Räty
2011-05-23 14:34 Petteri Räty
2011-04-27 15:11 Petteri Räty
2011-04-14  4:50 Petteri Räty
2011-04-14  4:50 Petteri Räty
2011-04-12 18:29 Petteri Räty
2011-04-12 18:29 Petteri Räty
2011-04-12 18:29 Petteri Räty
2011-04-06  7:43 Petteri Räty
2011-04-04 16:09 Petteri Räty
2011-04-04 15:52 Petteri Räty
2011-04-04 15:52 Petteri Räty
2011-03-30 12:48 Petteri Räty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c15de9151925dd3ede93ac00ebac07e629c86b6c.betelgeuse@gentoo \
    --to=betelgeuse@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox