Gentoo Archives: gentoo-commits

From: "Petteri Räty" <betelgeuse@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/libbash:master commit in: src/core/, src/core/tests/
Date: Wed, 06 Apr 2011 07:43:18
Message-Id: 951bb1b72491976c03939ac186c9cfe4a236fb84.betelgeuse@gentoo
1 commit: 951bb1b72491976c03939ac186c9cfe4a236fb84
2 Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
3 AuthorDate: Tue Apr 5 11:38:06 2011 +0000
4 Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
5 CommitDate: Tue Apr 5 11:38:06 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=951bb1b7
7
8 Rename is_null to is_unset_or_null
9
10 is_null method will always check if the variable is unset. So
11 change the name to a more proper one.
12
13 ---
14 src/core/interpreter.h | 4 ++--
15 src/core/tests/interpreter_test.cpp | 6 +++---
16 2 files changed, 5 insertions(+), 5 deletions(-)
17
18 diff --git a/src/core/interpreter.h b/src/core/interpreter.h
19 index c0cc12d..ab6b9e8 100644
20 --- a/src/core/interpreter.h
21 +++ b/src/core/interpreter.h
22 @@ -366,7 +366,7 @@ public:
23 /// if the variable is undefined
24 /// \param variable name
25 /// \return whether the value of the variable is null
26 - bool is_null(const std::string& name)
27 + bool is_unset_or_null(const std::string& name)
28 {
29 std::shared_ptr<variable> value = members.resolve(name);
30 if(value)
31 @@ -422,7 +422,7 @@ public:
32 const std::string do_default_expansion(const std::string& name,
33 const std::string& value)
34 {
35 - return (is_null(name)? value : resolve<std::string>(name));
36 + return (is_unset_or_null(name)? value : resolve<std::string>(name));
37 }
38 };
39 #endif
40
41 diff --git a/src/core/tests/interpreter_test.cpp b/src/core/tests/interpreter_test.cpp
42 index 6f8d0c4..2d46e62 100644
43 --- a/src/core/tests/interpreter_test.cpp
44 +++ b/src/core/tests/interpreter_test.cpp
45 @@ -44,13 +44,13 @@ TEST(interpreter, define_resolve_string)
46 EXPECT_STREQ("", walker.resolve<string>("undefined").c_str());
47 }
48
49 -TEST(interpreter, is_null)
50 +TEST(interpreter, is_unset_or_null)
51 {
52 interpreter walker;
53 walker.define("foo", "hello");
54 - EXPECT_FALSE(walker.is_null("foo"));
55 + EXPECT_FALSE(walker.is_unset_or_null("foo"));
56 walker.define("foo", "hello", false, true);
57 - EXPECT_TRUE(walker.is_null("foo"));
58 + EXPECT_TRUE(walker.is_unset_or_null("foo"));
59 }
60
61 TEST(interpreter, is_unset)