* [gentoo-commits] proj/libbash:master commit in: scripts/, /, utils/
@ 2011-06-09 11:46 Petteri Räty
0 siblings, 0 replies; only message in thread
From: Petteri Räty @ 2011-06-09 11:46 UTC (permalink / raw
To: gentoo-commits
commit: 28d34b34f5a431b3660c5c050f57413b2cb7e1e7
Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 7 11:10:41 2011 +0000
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Thu Jun 9 11:41:23 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=28d34b34
Test: add test for Portage functions
---
Makefile.am | 2 ++
scripts/isolated_functions.bash | 13 +++++++++++++
scripts/isolated_functions.bash.result | 12 ++++++++++++
utils/variable_printer.cpp | 11 ++++++++++-
4 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index f55db28..15d4b65 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -52,6 +52,7 @@ BASH_TESTS = scripts/var_def.bash \
scripts/command_execution.bash \
scripts/function_def.bash \
scripts/arithmetic_assignment.bash \
+ scripts/isolated_functions.bash \
scripts/compound_command.bash \
scripts/test_expr.bash \
scripts/binary_arithmetic.bash
@@ -60,6 +61,7 @@ BASH_RESULT = scripts/var_def.bash.result \
scripts/command_execution.bash.result \
scripts/function_def.bash.result \
scripts/arithmetic_assignment.bash.result \
+ scripts/isolated_functions.bash.result \
scripts/compound_command.bash.result \
scripts/test_expr.bash.result \
scripts/binary_arithmetic.bash.result
diff --git a/scripts/isolated_functions.bash b/scripts/isolated_functions.bash
new file mode 100644
index 0000000..ffdc14d
--- /dev/null
+++ b/scripts/isolated_functions.bash
@@ -0,0 +1,13 @@
+die "something wrong"
+has 123 456 123 456 && echo true
+has 123 456 13 456 && echo false
+hasq 123 123 456
+EXPORT_FUNCTIONS
+echo hi
+use
+useq
+use_with
+use_enable
+eerror foo
+debug-print foo
+ewarn foo
diff --git a/scripts/isolated_functions.bash.result b/scripts/isolated_functions.bash.result
new file mode 100644
index 0000000..a56974f
--- /dev/null
+++ b/scripts/isolated_functions.bash.result
@@ -0,0 +1,12 @@
+Die is called: something wrong
+true
+Die is called: EXPORT_FUNCTIONS without a defined ECLASS
+hi
+use shouldn't be called
+useq shouldn't be called
+use_with shouldn't be called
+use_enable shouldn't be called
+eerror: foo
+debug-print: foo
+ewarn: foo
+item=123
diff --git a/utils/variable_printer.cpp b/utils/variable_printer.cpp
index 252ee9b..9104273 100644
--- a/utils/variable_printer.cpp
+++ b/utils/variable_printer.cpp
@@ -36,6 +36,15 @@ static const std::vector<std::string> special_variables
"IFS", "?", "*", "0"
};
+static std::string get_src_dir()
+{
+ std::string srcdir(".");
+ if(getenv("srcdir"))
+ srcdir = getenv("srcdir");
+
+ return srcdir;
+}
+
int main(int argc, char** argv)
{
if(argc != 2)
@@ -48,7 +57,7 @@ int main(int argc, char** argv)
std::vector<std::string> functions;
try
{
- libbash::interpret(argv[1], variables, functions);
+ libbash::interpret(argv[1], get_src_dir() + "/utils/isolated-functions.sh", variables, functions);
}
catch(interpreter_exception& e)
{
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-09 11:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-09 11:46 [gentoo-commits] proj/libbash:master commit in: scripts/, /, utils/ Petteri Räty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox