@@ -429,17 +429,17 @@ var shellTests = []errorCase{
429
429
},
430
430
{
431
431
in : `((# 1 + 2))` ,
432
- bash : `1:1: unsigned expressions are a mksh feature` ,
432
+ bash : `1:1: unsigned expressions are a mksh feature; tried parsing as bash ` ,
433
433
},
434
434
{
435
435
in : `$((# 1 + 2))` ,
436
- posix : `1:1: unsigned expressions are a mksh feature` ,
437
- bash : `1:1: unsigned expressions are a mksh feature` ,
436
+ posix : `1:1: unsigned expressions are a mksh feature; tried parsing as posix ` ,
437
+ bash : `1:1: unsigned expressions are a mksh feature; tried parsing as bash ` ,
438
438
},
439
439
{
440
440
in : `${ foo;}` ,
441
- posix : `1:1: "${ stmts;}" is a mksh feature` ,
442
- bash : `1:1: "${ stmts;}" is a mksh feature` ,
441
+ posix : `1:1: "${ stmts;}" is a mksh feature; tried parsing as posix ` ,
442
+ bash : `1:1: "${ stmts;}" is a mksh feature; tried parsing as bash ` ,
443
443
},
444
444
{
445
445
in : `${ ` ,
@@ -455,8 +455,8 @@ var shellTests = []errorCase{
455
455
},
456
456
{
457
457
in : `${|foo;}` ,
458
- posix : `1:1: "${|stmts;}" is a mksh feature` ,
459
- bash : `1:1: "${|stmts;}" is a mksh feature` ,
458
+ posix : `1:1: "${|stmts;}" is a mksh feature; tried parsing as posix ` ,
459
+ bash : `1:1: "${|stmts;}" is a mksh feature; tried parsing as bash ` ,
460
460
},
461
461
{
462
462
in : `${|` ,
@@ -769,11 +769,11 @@ var shellTests = []errorCase{
769
769
},
770
770
{
771
771
in : "foo &>/dev/null" ,
772
- posix : `1:5: &> redirects are a bash/mksh feature` ,
772
+ posix : `1:5: &> redirects are a bash/mksh feature; tried parsing as posix ` ,
773
773
},
774
774
{
775
775
in : "foo &>>/dev/null" ,
776
- posix : `1:5: &> redirects are a bash/mksh feature` ,
776
+ posix : `1:5: &> redirects are a bash/mksh feature; tried parsing as posix ` ,
777
777
},
778
778
{
779
779
in : "<<" ,
@@ -1151,7 +1151,7 @@ var shellTests = []errorCase{
1151
1151
},
1152
1152
{
1153
1153
in : "echo ${%" ,
1154
- common : `1:6: "${%foo}" is a mksh feature` ,
1154
+ common : `1:6: "${%foo}" is a mksh feature; tried parsing as LANG ` ,
1155
1155
mksh : `1:8: parameter expansion requires a literal` ,
1156
1156
},
1157
1157
{
@@ -1280,7 +1280,7 @@ var shellTests = []errorCase{
1280
1280
},
1281
1281
{
1282
1282
in : "case i {" ,
1283
- common : `1:1: "case i {" is a mksh feature` ,
1283
+ common : `1:1: "case i {" is a mksh feature; tried parsing as LANG ` ,
1284
1284
mksh : `1:1: case statement must end with "}"` ,
1285
1285
},
1286
1286
{
@@ -1483,7 +1483,7 @@ var shellTests = []errorCase{
1483
1483
{
1484
1484
in : "[[ a =~" ,
1485
1485
bash : `1:6: =~ must be followed by a word` ,
1486
- mksh : `1:6: regex tests are a bash feature` ,
1486
+ mksh : `1:6: regex tests are a bash feature; tried parsing as mksh ` ,
1487
1487
},
1488
1488
{
1489
1489
in : "[[ -f a" ,
@@ -1851,8 +1851,8 @@ var shellTests = []errorCase{
1851
1851
// so that users won't think this will work like they expect in
1852
1852
// POSIX shell.
1853
1853
in : "echo {var}>foo" ,
1854
- posix : `1:6: {varname} redirects are a bash feature #NOERR` ,
1855
- mksh : `1:6: {varname} redirects are a bash feature #NOERR` ,
1854
+ posix : `1:6: {varname} redirects are a bash feature; tried parsing as posix #NOERR` ,
1855
+ mksh : `1:6: {varname} redirects are a bash feature; tried parsing as mksh #NOERR` ,
1856
1856
},
1857
1857
{
1858
1858
in : "echo ;&" ,
@@ -1871,115 +1871,115 @@ var shellTests = []errorCase{
1871
1871
},
1872
1872
{
1873
1873
in : "for i in 1 2 3; { echo; }" ,
1874
- posix : `1:17: for loops with braces are a bash/mksh feature` ,
1874
+ posix : `1:17: for loops with braces are a bash/mksh feature; tried parsing as posix ` ,
1875
1875
},
1876
1876
{
1877
1877
in : "for ((i=0; i<5; i++)); do echo; done" ,
1878
- posix : `1:5: c-style fors are a bash feature` ,
1879
- mksh : `1:5: c-style fors are a bash feature` ,
1878
+ posix : `1:5: c-style fors are a bash feature; tried parsing as posix ` ,
1879
+ mksh : `1:5: c-style fors are a bash feature; tried parsing as mksh ` ,
1880
1880
},
1881
1881
{
1882
1882
in : "echo !(a)" ,
1883
- posix : `1:6: extended globs are a bash/mksh feature` ,
1883
+ posix : `1:6: extended globs are a bash/mksh feature; tried parsing as posix ` ,
1884
1884
},
1885
1885
{
1886
1886
in : "echo $a@(b)" ,
1887
- posix : `1:8: extended globs are a bash/mksh feature` ,
1887
+ posix : `1:8: extended globs are a bash/mksh feature; tried parsing as posix ` ,
1888
1888
},
1889
1889
{
1890
1890
in : "foo=(1 2)" ,
1891
- posix : `1:5: arrays are a bash/mksh feature` ,
1891
+ posix : `1:5: arrays are a bash/mksh feature; tried parsing as posix ` ,
1892
1892
},
1893
1893
{
1894
1894
in : "a=$c\n '" ,
1895
1895
common : `2:1: reached EOF without closing quote '` ,
1896
1896
},
1897
1897
{
1898
1898
in : "echo ${!foo}" ,
1899
- posix : `1:6: "${!foo}" is a bash/mksh feature` ,
1899
+ posix : `1:6: "${!foo}" is a bash/mksh feature; tried parsing as posix ` ,
1900
1900
},
1901
1901
{
1902
1902
in : "echo ${!foo*}" ,
1903
- posix : `1:6: "${!foo*}" is a bash feature` ,
1904
- mksh : `1:6: "${!foo*}" is a bash feature` ,
1903
+ posix : `1:6: "${!foo*}" is a bash feature; tried parsing as posix ` ,
1904
+ mksh : `1:6: "${!foo*}" is a bash feature; tried parsing as mksh ` ,
1905
1905
},
1906
1906
{
1907
1907
in : "echo ${!foo@}" ,
1908
- posix : `1:12: this expansion operator is a bash/mksh feature` ,
1909
- mksh : `1:6: "${!foo@}" is a bash feature` ,
1908
+ posix : `1:12: this expansion operator is a bash/mksh feature; tried parsing as posix ` ,
1909
+ mksh : `1:6: "${!foo@}" is a bash feature; tried parsing as mksh ` ,
1910
1910
},
1911
1911
{
1912
1912
in : "echo ${!foo[@]}" ,
1913
- posix : `1:12: arrays are a bash/mksh feature` ,
1913
+ posix : `1:12: arrays are a bash/mksh feature; tried parsing as posix ` ,
1914
1914
},
1915
1915
{
1916
1916
in : "echo ${foo[1]}" ,
1917
- posix : `1:11: arrays are a bash/mksh feature` ,
1917
+ posix : `1:11: arrays are a bash/mksh feature; tried parsing as posix ` ,
1918
1918
},
1919
1919
{
1920
1920
in : "echo ${foo/a/b}" ,
1921
- posix : `1:11: search and replace is a bash/mksh feature` ,
1921
+ posix : `1:11: search and replace is a bash/mksh feature; tried parsing as posix ` ,
1922
1922
},
1923
1923
{
1924
1924
in : "echo ${foo:1}" ,
1925
- posix : `1:11: slicing is a bash/mksh feature` ,
1925
+ posix : `1:11: slicing is a bash/mksh feature; tried parsing as posix ` ,
1926
1926
},
1927
1927
{
1928
1928
in : "foo <<< bar" ,
1929
- posix : `1:5: herestrings are a bash/mksh feature` ,
1929
+ posix : `1:5: herestrings are a bash/mksh feature; tried parsing as posix ` ,
1930
1930
},
1931
1931
{
1932
1932
in : "foo << < bar" ,
1933
1933
posix : `1:5: << must be followed by a word` ,
1934
1934
},
1935
1935
{
1936
1936
in : "echo ${foo,bar}" ,
1937
- posix : `1:11: this expansion operator is a bash feature` ,
1938
- mksh : `1:11: this expansion operator is a bash feature` ,
1937
+ posix : `1:11: this expansion operator is a bash feature; tried parsing as posix ` ,
1938
+ mksh : `1:11: this expansion operator is a bash feature; tried parsing as mksh ` ,
1939
1939
},
1940
1940
{
1941
1941
in : "echo ${foo@Q}" ,
1942
- posix : `1:11: this expansion operator is a bash/mksh feature` ,
1942
+ posix : `1:11: this expansion operator is a bash/mksh feature; tried parsing as posix ` ,
1943
1943
},
1944
1944
{
1945
1945
in : "echo ${foo@a}" ,
1946
- mksh : `1:12: this expansion operator is a bash feature` ,
1946
+ mksh : `1:12: this expansion operator is a bash feature; tried parsing as mksh ` ,
1947
1947
},
1948
1948
{
1949
1949
in : "echo ${foo@u}" ,
1950
- mksh : `1:12: this expansion operator is a bash feature` ,
1950
+ mksh : `1:12: this expansion operator is a bash feature; tried parsing as mksh ` ,
1951
1951
},
1952
1952
{
1953
1953
in : "echo ${foo@A}" ,
1954
- mksh : `1:12: this expansion operator is a bash feature` ,
1954
+ mksh : `1:12: this expansion operator is a bash feature; tried parsing as mksh ` ,
1955
1955
},
1956
1956
{
1957
1957
in : "echo ${foo@E}" ,
1958
- mksh : `1:12: this expansion operator is a bash feature` ,
1958
+ mksh : `1:12: this expansion operator is a bash feature; tried parsing as mksh ` ,
1959
1959
},
1960
1960
{
1961
1961
in : "echo ${foo@K}" ,
1962
- mksh : `1:12: this expansion operator is a bash feature` ,
1962
+ mksh : `1:12: this expansion operator is a bash feature; tried parsing as mksh ` ,
1963
1963
},
1964
1964
{
1965
1965
in : "echo ${foo@k}" ,
1966
- mksh : `1:12: this expansion operator is a bash feature` ,
1966
+ mksh : `1:12: this expansion operator is a bash feature; tried parsing as mksh ` ,
1967
1967
},
1968
1968
{
1969
1969
in : "echo ${foo@L}" ,
1970
- mksh : `1:12: this expansion operator is a bash feature` ,
1970
+ mksh : `1:12: this expansion operator is a bash feature; tried parsing as mksh ` ,
1971
1971
},
1972
1972
{
1973
1973
in : "echo ${foo@P}" ,
1974
- mksh : `1:12: this expansion operator is a bash feature` ,
1974
+ mksh : `1:12: this expansion operator is a bash feature; tried parsing as mksh ` ,
1975
1975
},
1976
1976
{
1977
1977
in : "echo ${foo@U}" ,
1978
- mksh : `1:12: this expansion operator is a bash feature` ,
1978
+ mksh : `1:12: this expansion operator is a bash feature; tried parsing as mksh ` ,
1979
1979
},
1980
1980
{
1981
1981
in : "echo ${foo@#}" ,
1982
- bash : `1:12: this expansion operator is a mksh feature #NOERR` ,
1982
+ bash : `1:12: this expansion operator is a mksh feature; tried parsing as bash #NOERR` ,
1983
1983
},
1984
1984
{
1985
1985
in : "`\" `\\ " ,
@@ -1992,6 +1992,7 @@ func checkError(p *Parser, in, want string) func(*testing.T) {
1992
1992
if i := strings .Index (want , " #NOERR" ); i >= 0 {
1993
1993
want = want [:i ]
1994
1994
}
1995
+ want = strings .Replace (want , "LANG" , p .lang .String (), 1 )
1995
1996
_ , err := p .Parse (newStrictReader (in ), "" )
1996
1997
if err == nil {
1997
1998
t .Fatalf ("Expected error in %q: %v" , in , want )
0 commit comments