1 |
commit: bfeb754803ae1078046fd576151b5f387045c9d1 |
2 |
Author: Petteri Räty <petsku <AT> petteriraty <DOT> eu> |
3 |
AuthorDate: Fri May 27 22:59:36 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 27 22:59:36 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=bfeb7548 |
7 |
|
8 |
Merge remote-tracking branch 'mu/test_coverage' into review |
9 |
|
10 |
|
11 |
src/builtins/source_builtin.cpp | 3 +++ |
12 |
src/builtins/tests/declare_tests.cpp | 8 ++++++++ |
13 |
src/builtins/tests/return_tests.cpp | 1 + |
14 |
src/builtins/tests/shopt_tests.cpp | 20 ++++++++++++++++++-- |
15 |
src/builtins/tests/source_tests.cpp | 19 +++++++++++++++++++ |
16 |
src/core/interpreter.cpp | 3 ++- |
17 |
src/core/tests/bash_ast_test.cpp | 5 +++++ |
18 |
src/core/tests/bash_condition_test.cpp | 5 +++++ |
19 |
src/core/tests/interpreter_test.cpp | 15 ++++++++++++++- |
20 |
test/api_test.cpp | 5 +++++ |
21 |
10 files changed, 80 insertions(+), 4 deletions(-) |
22 |
|
23 |
diff --cc src/core/tests/interpreter_test.cpp |
24 |
index d64866f,d5e5d4a..6a39591 |
25 |
--- a/src/core/tests/interpreter_test.cpp |
26 |
+++ b/src/core/tests/interpreter_test.cpp |
27 |
@@@ -195,25 -170,14 +199,26 @@@ TEST(interpreter, unset_variables |
28 |
EXPECT_STREQ("123", walker.resolve<string>("var").c_str()); |
29 |
walker.unset("var"); |
30 |
EXPECT_STREQ("", walker.resolve<string>("var").c_str()); |
31 |
+ walker.unset("var"); |
32 |
+ |
33 |
+ EXPECT_THROW(walker.unset("ro_var"), unset_exception); |
34 |
+ EXPECT_THROW(walker.unset("ro_local_var"), unset_exception); |
35 |
+ EXPECT_THROW(walker.unset("1"), interpreter_exception); |
36 |
+} |
37 |
|
38 |
- EXPECT_THROW(walker.unset("ro_var"), interpreter_exception); |
39 |
+TEST(interpreter, unset_functions) |
40 |
+{ |
41 |
+ interpreter walker; |
42 |
+ walker.define_function("foo", 0); |
43 |
+ EXPECT_TRUE(walker.has_function("foo")); |
44 |
+ walker.unset_function("foo"); |
45 |
+ EXPECT_FALSE(walker.has_function("foo")); |
46 |
} |
47 |
|
48 |
- TEST(interperter, substring_expansion_exception) |
49 |
+ TEST(interperter, substring_expansion) |
50 |
{ |
51 |
interpreter walker; |
52 |
+ EXPECT_STREQ("", walker.do_substring_expansion("@", 0, 1, 2).c_str()); |
53 |
EXPECT_THROW(walker.do_substring_expansion("", 0, -1, 0), interpreter_exception); |
54 |
} |