aboutsummaryrefslogtreecommitdiff
path: root/syntax/scan_test.go
diff options
context:
space:
mode:
authoralandonovan <adonovan@google.com>2019-01-31 13:43:01 -0500
committerGitHub <noreply@github.com>2019-01-31 13:43:01 -0500
commitc1a3d543d12807004d4b0c0ab7c971122cad1c7d (patch)
treef45c5f75579f717e06e70f1b496df5ae7608eab8 /syntax/scan_test.go
parent367b72a99b3ae71eba6abdef0e529e871ec81d8f (diff)
downloadstarlark-go-c1a3d543d12807004d4b0c0ab7c971122cad1c7d.tar.gz
syntax: fix outdent bug in scanner (#105)
...caused by typo in slice expression. Also: - simplify expression for detecting blank lines. (I don't remember why the col > 0 clause was added; perhaps to mask this bug.) - add missing tokenNames[WHILE]. Fixes #104
Diffstat (limited to 'syntax/scan_test.go')
-rw-r--r--syntax/scan_test.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/syntax/scan_test.go b/syntax/scan_test.go
index 9864a1d..06f42db 100644
--- a/syntax/scan_test.go
+++ b/syntax/scan_test.go
@@ -209,6 +209,9 @@ pass`, "pass newline pass EOF"}, // consecutive newlines are consolidated
// github.com/google/starlark-go/issues/80
{"([{<>}])", "( [ { < > } ] ) EOF"},
{"f();", "f ( ) ; EOF"},
+ // github.com/google/starlark-go/issues/104
+ {"def f():\n if x:\n pass\n ", `def f ( ) : newline indent if x : newline indent pass newline outdent outdent EOF`},
+ {`while cond: pass`, "while cond : pass EOF"},
// github.com/google/starlark-go/issues/107
{"~= ~= 5", "~ = ~ = 5 EOF"},
} {