1 |
commit: 0a222ac2bce195a1bb162b93ba81c798cc1080d1 |
2 |
Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 25 15:11:43 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 26 14:56:30 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=0a222ac2 |
7 |
|
8 |
Test: improve test coverage for interpreter.cpp |
9 |
|
10 |
--- |
11 |
src/core/tests/interpreter_test.cpp | 13 ++++++++++++- |
12 |
1 files changed, 12 insertions(+), 1 deletions(-) |
13 |
|
14 |
diff --git a/src/core/tests/interpreter_test.cpp b/src/core/tests/interpreter_test.cpp |
15 |
index 0322a6b..d5e5d4a 100644 |
16 |
--- a/src/core/tests/interpreter_test.cpp |
17 |
+++ b/src/core/tests/interpreter_test.cpp |
18 |
@@ -59,6 +59,8 @@ TEST(interpreter, define_resolve_array) |
19 |
walker.define("partial", 10, false, 8); |
20 |
EXPECT_EQ(1, walker.get_array_length("partial")); |
21 |
EXPECT_EQ(10, walker.resolve<int>("partial", 8)); |
22 |
+ |
23 |
+ EXPECT_EQ(0, walker.get_array_length("not exist")); |
24 |
} |
25 |
|
26 |
TEST(interpreter, is_unset_or_null) |
27 |
@@ -172,9 +174,10 @@ TEST(interpreter, unset_values) |
28 |
EXPECT_THROW(walker.unset("ro_var"), interpreter_exception); |
29 |
} |
30 |
|
31 |
-TEST(interperter, substring_expansion_exception) |
32 |
+TEST(interperter, substring_expansion) |
33 |
{ |
34 |
interpreter walker; |
35 |
+ EXPECT_STREQ("", walker.do_substring_expansion("@", 0, 1, 2).c_str()); |
36 |
EXPECT_THROW(walker.do_substring_expansion("", 0, -1, 0), interpreter_exception); |
37 |
} |
38 |
|
39 |
@@ -203,3 +206,11 @@ TEST(interpreter, bash_option) |
40 |
walker.set_option("extglob", true); |
41 |
EXPECT_TRUE(walker.get_option("extglob")); |
42 |
} |
43 |
+ |
44 |
+TEST(interpreter, call_function) |
45 |
+{ |
46 |
+ interpreter walker; |
47 |
+ std::vector<std::string> arguments; |
48 |
+ |
49 |
+ EXPECT_EQ(-1, walker.call("not exist", arguments, 0, 0)); |
50 |
+} |