Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Apr 28, 2021
1 parent 8c478c7 commit 41ed70e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
8 changes: 4 additions & 4 deletions tests/errmsgs/t10734.nim
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
discard """
cmd: "nim check $file"
cmd: "nim check --hints:off $file"
errormsg: ""
nimout: '''
t10734.nim(19, 1) Error: invalid indentation
t10734.nim(19, 6) Error: invalid indentation
t10734.nim(20, 7) Error: expression expected, but found '[EOF]'
t10734.nim(18, 5) Error: 'proc' is not a concrete type; for a callback without parameters use 'proc()'
t10734.nim(19, 6) Error: undeclared identifier: 'p'
t10734.nim(19, 6) Error: expression 'p' has no type (or is ambiguous)
t10734.nim(19, 6) Error: 'p' cannot be assigned to
t10734.nim(17, 3) Hint: 'T' is declared but not used [XDeclaredButNotUsed]
t10734.nim(19, 6) Error: expression 'error p' has no type (or is ambiguous)
t10734.nim(19, 6) Error: 'error p' cannot be assigned to
'''
"""


type
T = object
a:
Expand Down
20 changes: 14 additions & 6 deletions tests/errmsgs/t10735.nim
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
discard """
cmd: "nim check $file"
cmd: "nim check --hints:off $file"
errormsg: "selector must be of an ordinal type, float or string"
nimout: '''
t10735.nim(38, 5) Error: 'let' symbol requires an initialization
t10735.nim(39, 10) Error: undeclared identifier: 'pos'
t10735.nim(39, 9) Error: type mismatch: got <cstring, >
t10735.nim(46, 5) Error: 'let' symbol requires an initialization
t10735.nim(47, 10) Error: undeclared identifier: 'pos'
t10735.nim(47, 10) Error: expression 'error pos' has no type (or is ambiguous)
t10735.nim(47, 10) Error: invalid expression: error pos
t10735.nim(47, 9) Error: type mismatch: got <cstring, >
but expected one of:
proc `[]`(s: string; i: BackwardsIndex): char
first type mismatch at position: 0
Expand All @@ -29,12 +31,18 @@ proc `[]`[T](s: var openArray[T]; i: BackwardsIndex): var T
template `[]`(s: string; i: int): char
first type mismatch at position: 0
expression: `[]`(buf, pos)
t10735.nim(39, 9) Error: selector must be of an ordinal type, float or string
expression: `[]`(buf, error pos)
t10735.nim(47, 9) Error: selector must be of an ordinal type, float or string
'''
joinable: false
"""

#[
PRTEMP: fix:
expression: `[]`(buf, error pos)
]#

# line 45
let buf: cstring
case buf[pos]
else:
Expand Down
14 changes: 7 additions & 7 deletions tests/errmsgs/t16178_nimcheck_redundant.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ t16178_nimcheck_redundant.nim(32, 11) Error: undeclared identifier: 'bad5'
t16178_nimcheck_redundant.nim(36, 11) Error: expression 'error' has no type (or is ambiguous)
t16178_nimcheck_redundant.nim(40, 11) Error: expression 'error' has no type (or is ambiguous)
t16178_nimcheck_redundant.nim(44, 15) Error: expression 'error' has no type (or is ambiguous)
t16178_nimcheck_redundant.nim(49, 12) Error: undeclared field: 'f1' for type t16178_nimcheck_redundant.A [type declared in t16178_nimcheck_redundant.nim(47, 8)]
t16178_nimcheck_redundant.nim(49, 12) Error: undeclared field: 'f1' for type t16178_nimcheck_redundant.A [type declared in t16178_nimcheck_redundant.nim(47, 8)]
t16178_nimcheck_redundant.nim(49, 12) Error: expression 'error' has no type (or is ambiguous)
t16178_nimcheck_redundant.nim(50, 12) Error: undeclared field: 'f2' for type t16178_nimcheck_redundant.A [type declared in t16178_nimcheck_redundant.nim(47, 8)]
t16178_nimcheck_redundant.nim(50, 12) Error: undeclared field: 'f2' for type t16178_nimcheck_redundant.A [type declared in t16178_nimcheck_redundant.nim(47, 8)]
t16178_nimcheck_redundant.nim(50, 12) Error: expression 'error' has no type (or is ambiguous)
t16178_nimcheck_redundant.nim(51, 8) Error: attempting to call undeclared routine: 'f3='
t16178_nimcheck_redundant.nim(52, 8) Error: attempting to call undeclared routine: 'f4='
'''
"""

#[
xxx the line `Error: 'let' symbol requires an initialization` is redundant and should not
be reported; likewise with `t16178_nimcheck_redundant.nim(22, 15) Error: expression '' has no type (or is ambiguous)`

TODO: the trailing space `_redundant.nim(47, 8)] ` is bad
]#








Expand Down

0 comments on commit 41ed70e

Please sign in to comment.