interp: more tests for ignoreScannerError

They cover the extra cases that were "sneakily" added
after 611a8c37fa
This commit is contained in:
mpl
2020-08-14 15:04:11 +02:00
committed by GitHub
parent da9e6a0d6c
commit 332becf95d

View File

@@ -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 {