blob: 5af1c113f38787d020fa676805eaf53d38e05205 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/*
Please use git log for copyright holder and year information
This file is part of libbash.
libbash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
libbash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with libbash. If not, see <http://www.gnu.org/licenses/>.
*/
gunit java_libbash;
variable_definition_atom:
"arr[foo]=\"asdf\"" -> (= (arr (ARITHMETIC (VAR_REF foo))) (STRING (DOUBLE_QUOTED_STRING asdf)))
"arr=(a b [4]=c)" -> (= arr (ARRAY (STRING a) (STRING b) (= (ARITHMETIC 4) (STRING c))))
"asdf[idx]=${var}" -> (= (asdf (ARITHMETIC (VAR_REF idx))) (STRING (VAR_REF var)))
"asdf[++i]=${var}" -> (= (asdf (ARITHMETIC (PRE_INCR (VAR_REF i)))) (STRING (VAR_REF var)))
"asdf[++i,j]=${var}" -> (= (asdf (ARITHMETIC (PRE_INCR (VAR_REF i))) (ARITHMETIC (VAR_REF j))) (STRING (VAR_REF var)))
"asdf[$((i))]=${var}" -> (= (asdf (ARITHMETIC (VAR_REF i))) (STRING (VAR_REF var)))
"asdf[1]=(a b c)" FAIL
|