interp: more tests for ignoreScannerError
They cover the extra cases that were "sneakily" added
after 611a8c37fa
This commit is contained in:
@@ -686,7 +686,7 @@ func assertEval(t *testing.T, i *interp.Interpreter, src, expectedError, expecte
|
||||
}
|
||||
}
|
||||
|
||||
func TestEvalEOF(t *testing.T) {
|
||||
func TestEvalScanner(t *testing.T) {
|
||||
tests := []struct {
|
||||
desc string
|
||||
src []string
|
||||
@@ -719,6 +719,31 @@ func TestEvalEOF(t *testing.T) {
|
||||
},
|
||||
errorLine: 1,
|
||||
},
|
||||
{
|
||||
desc: "multi-line string literal",
|
||||
src: []string{
|
||||
"var a = `hello",
|
||||
"there, how",
|
||||
"are you?`",
|
||||
},
|
||||
errorLine: -1,
|
||||
},
|
||||
{
|
||||
desc: "multi-line comma operand",
|
||||
src: []string{
|
||||
`println(2,`,
|
||||
`3)`,
|
||||
},
|
||||
errorLine: -1,
|
||||
},
|
||||
{
|
||||
desc: "multi-line arithmetic operand",
|
||||
src: []string{
|
||||
`println(2. /`,
|
||||
`3.)`,
|
||||
},
|
||||
errorLine: -1,
|
||||
},
|
||||
}
|
||||
|
||||
for it, test := range tests {
|
||||
|
||||
Reference in New Issue
Block a user