################## TEST 1 ##################
ciao! at line 29 == 29
hello at line 22 == 22
ERROR: test1.sh failed at line 30, rc: 1
onerror() at line 16 == 16
mytest should have failed at line 30
pippo
ERROR: test1.sh failed at line 34, rc: 1
onerror() at line 16 == 16
exit in () at line 1 == 34 with pippo but not pluto
exit code 1
#############################################

################## TEST 2 ##################
ciao! at line 29 == 29
hello at line 22 == 22
ERROR: test2.sh failed at line 30, rc: 1
onerror() at line 16 == 16
mytest should have failed at line 30
pippo
ERROR: test2.sh failed at line 34, rc: 1
onerror() at line 16 == 16
exit at line 1 == 34 with pippo but not pluto
exit code 1
#############################################

################## TEST 4 ##################
hello by mytest() at line 22 == 22
ERROR: test4.sh failed at line 30, rc: 1
onerror() at line 16 == 16
Tracing error in function starts here (set -E)
hello by mytest() at line 22 == 22
ERROR: test4.sh failed in mytest() at line 23, rc: 1
onerror() at line 16 == 16
ERROR: test4.sh failed at line 34, rc: 1
onerror() at line 16 == 16
ciao! at line 36 == 36
hello by mytest() at line 22 == 22
ERROR: test4.sh failed in mytest() at line 23, rc: 1
onerror() at line 16 == 16
exit in mytest() at line 1 == 23 without any onerror print
exit code 1
#############################################

################## TEST 5 ##################
funcname in script: '' == ''
ciao! at line 29 == 29
hello at line 22 == 22
ERROR: test5.sh failed at line 30, rc: 1
onerror() at line 16 == 16
mytest should have failed at line 30
pippo
ERROR: test5.sh failed at line 34, rc: 1
onerror() at line 16 == 16
this is a multi-line trap which begins at line 11 == 9
exit at line 2 == 34 with pippo but not pluto
this is a multi-line trap which ends at line 11 == 11
exit code 1
#############################################

################## TEST 6 ##################
ciao! at line 29 == 29
hello by mytest() at line 22 == 22
exit in mytest() at line 1 == 30 with pippo but not pluto
exit code 0
#############################################

################## TEST 7 ##################
ciao! at line 29 == 29
hello by mytest() at line 22 == 22
pippo
hello by mytest() at line 22 == 22
ERROR: test7.sh failed in mytest() at line 23, rc: 1
onerror() at line 16 == 16
mytest should have failed at line 30 and it will again at line 36
hello by mytest() at line 22 == 22
ERROR: test7.sh failed in mytest() at line 23, rc: 1
onerror() at line 16 == 16
exit in mytest() at line 1 == 23 with pippo but not pluto
exit code 1
#############################################

################## TEST 8 ##################
ciao! at line 29 == 29
hello by mytest() at line 22 == 22
pippo, exit status 0 == 0
LINENO=33 == 33, FUNCNAME='' == ''
setoinvalid LINENO=10 == 10
tests/test8.sh: line 10: set: invalid: invalid option name
ERROR: test8.sh failed at line 34, rc: 2 != 0
onerror() at line 16 == 16
LINENO=35 == 35, FUNCNAME='' == ''
LINENO=37
tests/test8.sh: line 37: set: invalid: invalid option name
ERROR: test8.sh failed at line 37, rc: 2 != 0
onerror() at line 16 == 16
exit in () at line 1 == 37 with pippo but not pluto
exit code 2
#############################################

################## TEST A ##################
ciao! at line 29 == 29, FUNCNAME = ''
hello by mytest() at line 22 == 22
ciao! at line 31 == 31, FUNCNAME = ''
pippo
tests/testA.sh: line 33: /access-denied: Permission denied
ERROR: testA.sh failed at line 33, rc: 1
onerror() at line 16 == 16
The script should have failed at line 33 with ERROR message, exitstatus 1 != 0
hello by mytest() at line 22 == 22
ERROR: testA.sh failed in mytest() at line 23, rc: 1
onerror() at line 16 == 16
exit in mytest() at line 1 == 23 with pippo but not pluto
exit code 1
#############################################

################## TEST B ##################
hello by myecho() at line 27
FUNCNAME = , LINENO = 45, EXITSTATUS: 0
FUNCNAME = , LINENO = 46
hello by mytrue() at line 36
FUNCNAME = , LINENO = 47, EXITSTATUS: 0
FUNCNAME = , LINENO = 48
hello by myfalse() at line 31
FUNCNAME = , LINENO = 50
hello by myfalse() at line 31
FUNCNAME = , LINENO = 51, EXITSTATUS: 1
FUNCNAME = , LINENO = 52
hello by mytrue() at line 36
FUNCNAME = , LINENO = 53, EXITSTATUS: 0
FUNCNAME = , LINENO = 54
hello by myfalse() at line 31
ERROR: testB.sh failed in myfalse() at line 32, rc: 1
onerror() at line 16 == 16
ERROR: testB.sh failed at line 55, rc: 1
onerror() at line 16 == 16
FUNCNAME = , LINENO = 55, EXITSTATUS: 1
FUNCNAME = , LINENO = 56
hello by myexit() at line 22
exit in myexit() at line 1 == 60, EXITSTATUS: 1
exit code 1
#############################################

################## TEST C ##################
hello by myecho() at line 27
FUNCNAME = , LINENO = 45, EXITSTATUS: 0
FUNCNAME = , LINENO = 46
hello by mytrue() at line 36
FUNCNAME = , LINENO = 47, EXITSTATUS: 0
FUNCNAME = , LINENO = 48
hello by myfalse() at line 31
FUNCNAME = , LINENO = 50
hello by myfalse() at line 31
FUNCNAME = , LINENO = 51, EXITSTATUS: 1
FUNCNAME = , LINENO = 52
hello by mytrue() at line 36
FUNCNAME = , LINENO = 53, EXITSTATUS: 0
FUNCNAME = , LINENO = 54
hello by myfalse() at line 31
ERROR: testC.sh failed in myfalse() at line 32, rc: 1
onerror() at line 16 == 16
ERROR: testC.sh failed at line 55, rc: 1
onerror() at line 16 == 16
FUNCNAME = , LINENO = 55, EXITSTATUS: 1
FUNCNAME = , LINENO = 56
hello by myfalse() at line 31
ERROR: testC.sh failed in myfalse() at line 32, rc: 1
onerror() at line 16 == 16
exit in myfalse() at line 1 == 32, EXITSTATUS: 1
exit code 1
#############################################

################## TEST D ##################
shell: bash
LINENO=0
trap -- ')' ERR
-----------
tests/testD.sh: error trap: line 4: syntax error near unexpected token `)'
tests/testD.sh: error trap: line 4: `)'
tests/testD.sh: error trap: line 4: syntax error near unexpected token `)'
tests/testD.sh: error trap: line 4: `)'
tests/testD.sh: error trap: line 4: syntax error near unexpected token `)'
tests/testD.sh: error trap: line 4: `)'
FUNCNAME='cmdevalfalse' == 'cmdevalfalse'
FUNCNAME='' == ''
-----------
trap -- 'echo ERR' ERR
still running
ERR
1
still running after false
tests/testD.sh: eval: line 44: syntax error near unexpected token `)'
tests/testD.sh: eval: line 44: `)'
done
exit code 0
#############################################

################## TEST E ##################
ERR ONE, funcone at line 5
funcone exit status = 0 == 1
ERR ONE, at line 32
-----------------01----------------------
ERR ONE, funcone at line 5
ERR ONE, at line 38
funcone exit status = 1 == 1
ERR ONE, at line 40
-----------------02----------------------
ERR ONE, funcone at line 5
ERR ONE, functwo at line 10
ERR ONE, at line 44
ERR ONE, at line 45
-----------------03----------------------
ERR ONE, functhree at line 14
ERR ONE, funcone at line 5
ERR ONE, functwo at line 10
ERR ONE, functhree at line 15
ERR ONE, functhree at line 19
ERR ONE, at line 49
ERR ONE, at line 53
-----------------04----------------------
-----------------05----------------------
ERR ONE, funcone at line 5
ERR ONE, functwo at line 10
ERR ONE, at line 68
-----------------06----------------------
ERR ONE, funcone at line 5
ERR ONE, functwo at line 10
ERR ONE, functhree at line 19
ERR ONE, at line 72
ERR ONE, at line 73
-----------------07----------------------
ERR ONE, at line 77
ERR ONE, at line 78
-----------------08----------------------
ERR MAIN
ERR ONE, funcone at line 5
ERR ONE, at line 85
-----------------09----------------------
ERR ONE, funcone at line 5
ERR ONE, functwo at line 10
ERR ONE, at line 89
ERR ONE, at line 90
-----------------10----------------------
ERR ONE, funcone at line 5
ERR ONE, functwo at line 10
ERR ONE, functhree at line 19
ERR ONE, at line 94
ERR ONE, at line 95
-----------------11----------------------
ERR ONE, at line 99
ERR ONE, at line 100
-----------------12----------------------
ERR MAIN
ERR ONE, funcone at line 5
ERR ONE, at line 108
-----------------13----------------------
ERR ONE, funcone at line 5
ERR ONE, functwo at line 10
ERR ONE, at line 112
ERR ONE, at line 113
-----------------14----------------------
ERR ONE, functhree at line 14
ERR ONE, funcone at line 5
ERR ONE, functwo at line 10
ERR ONE, functhree at line 15
ERR ONE, functhree at line 19
ERR ONE, at line 117
ERR ONE, at line 121
-----------------15----------------------
-----------------16----------------------
trap -- 'echo ERR MAIN' ERR
ERR MAIN
-----------------17----------------------
tests/testE.sh: line 142: /access-denied: Permission denied
ERR myfault at line 142
-----------------18----------------------
tests/testE.sh: eval: line 152: syntax error near unexpected token `)'
tests/testE.sh: eval: line 152: `)'
ERR myfault2 at line 152
ERR myfault2 at line 152
ERR at line 164
tests/testE.sh: eval: line 165: syntax error near unexpected token `)'
tests/testE.sh: eval: line 165: `)'
ERR at line 165
ERR at line 165
tests/testE.sh: line 166: /access-denied: Permission denied
ERR at line 166
-----------------19----------------------
EXIT myexit at line 1 == 178
exit code 1
#############################################

################## TEST F ##################
tests/testF.sh: eval: line 6: syntax error near unexpected token `)'
tests/testF.sh: eval: line 6: `)'
hello 1
tests/testF.sh: eval: line 11: syntax error near unexpected token `)'
tests/testF.sh: eval: line 11: `)'
tests/testF.sh: eval: line 11: syntax error near unexpected token `)'
tests/testF.sh: eval: line 11: `)'
hello 2
exit code 0
#############################################

################## TEST G ##################
ERR at in myfalse at 4, exit with 1
exit code 1
#############################################

