* refs #15667 improve invalid indentation errors * also show line info where = is missing * add test * add more tests
This commit is contained in:
parent
1822ed384a
commit
08262206d3
3 changed files with 74 additions and 4 deletions
58
tests/parser/t15667.nim
Normal file
58
tests/parser/t15667.nim
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
discard """
|
||||
cmd: "nim check $options $file"
|
||||
action: "reject"
|
||||
nimout: '''
|
||||
t15667.nim(23, 5) Error: invalid indentation, maybe you forgot a '=' at t15667.nim(22, 13) ?
|
||||
t15667.nim(28, 5) Error: invalid indentation, maybe you forgot a '=' at t15667.nim(26, 13) ?
|
||||
t15667.nim(33, 5) Error: invalid indentation, maybe you forgot a '=' at t15667.nim(31, 25) ?
|
||||
t15667.nim(42, 5) Error: invalid indentation, maybe you forgot a '=' at t15667.nim(38, 12) ?
|
||||
t15667.nim(56, 5) Error: invalid indentation, maybe you forgot a '=' at t15667.nim(55, 13) ?
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# line 20
|
||||
block:
|
||||
proc fn1()
|
||||
discard
|
||||
|
||||
block:
|
||||
proc fn2()
|
||||
#
|
||||
discard
|
||||
|
||||
block:
|
||||
proc fn3() {.exportc.}
|
||||
#
|
||||
discard
|
||||
|
||||
block: # complex example
|
||||
proc asdfasdfsd() {. exportc,
|
||||
inline
|
||||
.} # foo
|
||||
#[
|
||||
bar
|
||||
]#
|
||||
discard
|
||||
|
||||
block: # xxx this doesn't work yet (only a bare `invalid indentation` error)
|
||||
proc fn5()
|
||||
##
|
||||
discard
|
||||
|
||||
block: # ditto
|
||||
proc fn6*()
|
||||
## foo bar
|
||||
runnableExamples: discard
|
||||
|
||||
block:
|
||||
proc fn8()
|
||||
runnableExamples:
|
||||
discard
|
||||
discard
|
||||
Loading…
Add table
Add a link
Reference in a new issue