diff options
author | Petteri Räty <petsku@petteriraty.eu> | 2011-04-14 07:48:54 +0300 |
---|---|---|
committer | Petteri Räty <petsku@petteriraty.eu> | 2011-04-14 07:48:54 +0300 |
commit | 9b72788bf2f6cd763a4f99f39827b1a8c19e8cb2 (patch) | |
tree | d2338a7d9c82163440e49202fab1b9cf824d1b4d /test | |
parent | Change place where to report bugs (diff) | |
parent | Implement array element in arithmetic expansion (diff) | |
download | libbash-9b72788bf2f6cd763a4f99f39827b1a8c19e8cb2.tar.gz libbash-9b72788bf2f6cd763a4f99f39827b1a8c19e8cb2.tar.bz2 libbash-9b72788bf2f6cd763a4f99f39827b1a8c19e8cb2.zip |
Merge remote-tracking branch 'mu/master'
Conflicts:
src/core/interpreter.h
Diffstat (limited to 'test')
-rw-r--r-- | test/variable_printer.cpp | 4 | ||||
-rw-r--r-- | test/walker_test.cpp | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/test/variable_printer.cpp b/test/variable_printer.cpp index cb17b9d..ed4aa69 100644 --- a/test/variable_printer.cpp +++ b/test/variable_printer.cpp @@ -44,9 +44,11 @@ int main(int argc, char** argv) libbash::interpret(argv[1], variables); std::map<std::string, std::vector<std::string>> sorted(variables.begin(), variables.end()); + // Currently we don't need internal variables + sorted.erase("IFS"); using namespace boost::spirit::karma; - std::cout << format((string << '=' << (string % ' ')) % eol, sorted) << std::endl; + std::cout << format((string << '=' << -(string % ' ')) % eol, sorted) << std::endl; return 0; } diff --git a/test/walker_test.cpp b/test/walker_test.cpp index 8185710..6f13176 100644 --- a/test/walker_test.cpp +++ b/test/walker_test.cpp @@ -59,3 +59,16 @@ TEST_STRING_ASSIGNMENT(str_assignment6, "str=\"/ \n \r\n & && ||| || > < ' : ; , ( (( ) )) ;; { } >= <=\"", "str", "/ \n \r\n & && ||| || > < ' : ; , ( (( ) )) ;; { } >= <=") + +TEST(array_index, out_of_bound) +{ + std::string script = "a[-1]=\"1\""; + std::istringstream input(script); + parser_builder pbuilder(input); + EXPECT_THROW(pbuilder.create_walker_builder(), interpreter_exception); + + std::string script2 = "a=(1 2 [-5]=1)"; + std::istringstream input2(script2); + parser_builder pbuilder2(input2); + EXPECT_THROW(pbuilder2.create_walker_builder(), interpreter_exception); +} |